Abdul Malik bin Saeed bin Suwaid Ansari says that I heard from Sayyiduna Abu Humaid and Sayyiduna Abu Usaid (may Allah be pleased with them both), they were stating that the Messenger of Allah (peace and blessings be upon him) said: When any one of you enters the mosque, he should recite this supplication: "Allahumma iftah lana abwaba rahmatik" (O Allah! Open for us the doors of Your mercy), and when he leaves the mosque, he should recite: "Allahumma inni as'aluka min fadlik" (O Allah! I ask You for Your bounty).
Hadith Referenceالفتح الربانی / أبواب المساجد / 1331
Hadith Gradingمحدثین:صحیح
Hadith Takhrij«أخرجه مسلم: 713،والنسائي: 2/ 53، وأخرجه ابوداود: 465 و زاد: ((فليسلم او ليصل علي النبي صلي الله عليه وآله وسلم )) ، (انظر مسند أحمد ترقيم الرسالة: 16057 ترقیم بيت الأفكار الدولية: 16154»
Brief Explanation
Benefits: … Since the mosque is the place for the commerce of the Hereafter, therefore, upon entering it, one specifically asks for mercy. And generally, a believer leaves the mosque in search of sustenance, so at that time, Allah Ta‘ala’s bounty is sought.