Furthermore, when a Muslim enters the mosque, it is recommended that he say: “In the name of Allah. May peace and blessings be upon the Messenger of Allah. O Allah, open for me the gates of Your mercy.” He should also say: “I seek refuge in Allah the Magnificent, in His noble countenance, and in His eternal dominion from Satan, the accursed.”
When leaving, he should say: “In the name of Allah. May peace and blessings be upon the Messenger of Allah. O Allah, I ask You of Your bounty. O Allah, protect me from Satan, the accursed.” This is indicated by several hadiths taken together:
Anas ibn Mālik—may Allah be pleased with him—said: “When the Messenger of Allah—peace and blessings be upon him—entered the mosque, he would say: ‘In the name of Allah. O Allah, send blessings upon Muhammad.’ When he left, he would say: ‘In the name of Allah. O Allah, send blessings upon Muhammad.’” Narrated by Ibn al-Sunnī in The Deeds of the Day and Night1.
Abū Hurayra—may Allah be pleased with him—reported that the Prophet—peace and blessings be upon him—said: “When one of you enters the mosque, let him invoke peace upon the Prophet and say: ‘O Allah, open for me the gates of Your mercy.’ When he leaves, let him invoke peace upon the Prophet and say: ‘O Allah, protect me from Satan.’” Narrated by al-Nasā’ī, Ibn Mājah, and al-Hākim2. One version reads: “O Allah, keep Satan far from me.”
Abū Humayd—or Abū Usayd—may Allah be pleased with them both, reported that the Messenger of Allah—peace and blessings be upon him—said: “When one of you enters the mosque, let him say: ‘O Allah, open for me the gates of Your mercy,’ and when