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 thy mercy. And when he goes out, he should say: O Allah, I ask thee out of Thine abundance. (Using translation from Abū Dāʾūd 465)
"إذا دخلَ أحدُكمْ المَسْجِدَ فَليَقُلِ: اللهُمَ افْتَحْ لِي أبوابَ رَحْمَتِكَ، وإذَا خَرَجَ فَليَقُلِ: اللهُمَّ إِنى أسْألُكَ منْ فَضْلِكَ".