When any of you enters the mosque, let him say: 'Allahumma iftah li abwāba rahmatik' (O Allah, open for me the gates of Your mercy). And when he leaves, let him say: 'Allahumma inni as’aluka min fadlik' (O Allah, I ask You of Your bounty)
Abu Humayd or Abu Usayd reported: The Messenger of Allah (may Allah’s peace and blessings be upon him) said:
"When any of you enters the mosque, let him say: 'Allahumma iftah li abwāba rahmatik' (O Allah, open for me the gates of Your mercy). And when he leaves, let him say: 'Allahumma inni as’aluka min fadlik' (O Allah, I ask You of Your bounty)."
«إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيَقُلِ: اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ، وَإِذَا خَرَجَ فَلْيَقُلِ: اللَّهُمَّ إِنِّي أَسْأَلُكَ مِنْ فَضْلِكَ».
The Prophet (may Allah's peace and blessings be upon him) directed his Ummah to the supplication to be said upon entering the mosque: "O Allah, open for me the gates of Your mercy." He asks Allah Almighty to provide him with the means to attain His mercy. And when he wants to leave, he should say: "O Allah, I ask You of Your bounty." He asks Allah for His bounty and more of His benevolence in providing lawful sustenance.
It is recommended to say this supplication upon entering the mosque and upon leaving it.
Mercy is mentioned in relation to entering, while bounty is in relation to leaving because when a person enters the mosque, he engages in deeds that bring him closer to Allah and His Paradise. So it is befitting to mention mercy, and when he leaves, he goes about in the land in pursuit of Allah's bounty of sustenance, and so the mention of bounty befits that.
These dhikrs are to be said upon entering the mosque and upon leaving it.
Sahīh Muslim (1/ 494) (713).
More (3)
الكاشف عن حقائق السُّنن (3/935).
فيض القدير (1/ 336).
ذخيرة العقبى (9/153).
Cited in books
10 Books- A Concise Summary of the Etiquettes of Travel, Description of Hajj and ‘Umrah, Etiquettes of Visiting, and Comprehensive Supplications, with an Appendix on Fatwas and Violations.2- المختصر في صفة الحج وأحكامه (للحرمين)“O Allah, open for me the gates of Your mercy” [2],
- Hisn Al-Muslim (Fortress of the Muslim) Supplications from the Qur’an and Sunnahحصن المسلمAllāhumma inni as’aluka min fadlik
- رسالة في الأذكار1«إِذَا دَخَلَ أَحَدُكُمُ المَسْجِدَ فَلْيَقُلِ: اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ، وَإِذَا خَرَجَ فَلْيَقُلِ: اللَّهُمَّ إِنِّي أَسْأَلُكَ مِنْ فَضْلِكَ».
- The Virtues and Etiquettes of the Prophet's Mosque and the Rulings of Visiting the Grave of the Prophet (ﷺ) and the Graves of His Two Companions (may Allah be pleased with them)فضائل وآداب المسجد النبوي، وأحكام زيارة قبر النبي عليه الصلاة والسلام وقبري صاحبيه“O Allah, I ask You for Your favour” [19],
More (6)
- الذكر والدعاء والعلاج بالرقي من الكتاب والسنة"إذا دخل أحدكم المسجد فليقل: اللهم افتح لي أبواب رحمتك. وإذا خرج فليقل: اللهم إني أسألك من فضلك".
- المختصر في صفة الحج وأحكامهالمختصر في صفة الحج والعمرة«اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ»[2]،
- ما لا يسع أطفال المسلمين جهله«اللَّهُمَّ إِنِّي أَسْأَلُكَ مِنْ فَضْلِكَ»[150].
- ما لا يسع أطفال المسلمين جهلهج: «اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ»[221].
- ما لا يسع أطفال المسلمين جهلهج: «اللَّهُمَّ إِنِّي أَسْأَلُكَ مِنْ فَضْلِكَ»[222].
- مجموعة زاد التربية الإسلامية (3)، والسيرة النبوية (3)التربية الإٍسلامية -3- «اللهم إني أسألك من فضلك»