كتاب الصلاة
Read the English translation first, with the original Arabic directly underneath.
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.
إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ صلى الله عليه وسلم ثُمَّ لْيَقُلِ اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ فَإِذَا خَرَجَ فَلْيَقُلِ اللَّهُمَّ إِنِّي أَسْأَلُكَ مِنْ فَضْلِكَ