Abu Usaid al-Ansari reported the Messenger of Allah (May peace be upon him) 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 thy mercy. And when he goes out, he should say: O Allah, I ask thee out of Thine abundance
Hadith No. 465
Sunan Abu Dawud
Gradings:
Al-Albani:
Sahih
Muhammad Muhyi Al-Din Abdul Hamid:
Sahih
Shuaib Al Arnaut:
Sahih
Zubair Ali Zai:
Isnaad Sahih Sahih Muslim (713)