Sahih Muslim 713 a
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 reported that the Messenger of Allah (ﷺ) said:
When any one of you enters the mosque, he should say:" O Allah! open for me the doors of Your mercy" ; and when he steps out he should say: 'O Allah! I beg of You Your Grace." (Imam Muslim said: I heard Yahya saying: I transcribed this hadith from the compilation of Sulaiman b. Bilal.)
Full reference and source
Sahih Muslim 713 a In-book : Book 6, Hadith 82 USC-MSA web (English) : Book 4, Hadith 1538 (deprecated)
View source on Sunnah.com (opens in a new tab)