The Messenger of Allah ﷺ said, "There are three people, all of whom are under Allah's guarantee. A man who goes out as a warrior in the path of Allah is under Allah's guarantee until He takes his soul and admits him into Paradise, or returns him with whatever reward and spoils he has gained. A man who goes to the mosque is under Allah's guarantee until He takes his soul and admits him into Paradise, or returns him with whatever reward and spoils he has gained. And a man who enters his home with the greeting of peace is under Allah's
guarantee."
عن رسول الله ﷺ قال: ثلاثة كلهم ضامن على الله عز وجل: رجل خرج غازيا في سبيل الله فهو ضامن على الله حتى يتوفاه، فيدخله الجنة، أو يرده بما نال من أجر وغنيمة، ورجل راح إلى المسجد، فهو ضامن على الله حتى يتوفاه، فيدخله الجنة، أو يرده بما نال من أجر وغنيمة، ورجل دخل بيته بسلام، فهو ضامن على الله عز وجل.
Reported by Abu Dawud (2494), and Hakim (2/73), and from him Bayhaqi (9/166), and Ibn Hibban graded it sahih (499), all of them from the hadith of Sulayman bin Habib, from Abu Umama Bahili, who related it.Hakim said, "This is a hadith sahih in its chain of transmission."Likewise, Hafiz graded it sahih in Fath al-Bari (8/6).