Sunan Abi Dawud 465
Grading supplied with this record: Sahih (Al-Albani)
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ صلى الله عليه وسلم ثُمَّ لْيَقُلِ اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ فَإِذَا خَرَجَ فَلْيَقُلِ اللَّهُمَّ إِنِّي أَسْأَلُكَ مِنْ فَضْلِكَ "
Abu Usaid al-Ansari reported the Messenger of Allah (ﷺ) as saying:
when any of you enters the mosque he should invoke blessing on the prophet (ﷺ) and then he should say: O Allah, open to me the gates of your mercy. And when he goes out, he should say: O Allah, I ask you out of Your Abundance.
Full reference and source
Sunan Abi Dawud 465 In-book : Book 2, Hadith 75 English translation : Book 2, Hadith 465
View source on Sunnah.com (opens in a new tab)