Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
hakim:747Abū al-ʿAbbās Muḥammad b. Yaʿqūb > Muḥammad b. Sinān al-Qazzāz

[Machine] The Messenger of Allah ﷺ said: "When one of you enters the mosque, let him send blessings upon the Prophet ﷺ and say: ‘O Allah, grant me protection from the accursed Satan.’"  

الحاكم:٧٤٧حَدَّثَنَا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ ثنا مُحَمَّدُ بْنُ سِنَانٍ الْقَزَّازُ ثنا أَبُو بَكْرٍ عَبْدُ الْكَبِيرِ بْنُ عَبْدِ الْمَجِيدِ الْحَنَفِيُّ ثنا الضَّحَّاكُ بْنُ عُثْمَانَ حَدَّثَنِي سَعِيدٌ الْمَقْبُرِيُّ عَنْ أَبِي هُرَيْرَةَ

أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُصَلِّ عَلَى النَّبِيِّ ﷺ وَلْيَقُلْ اللَّهُمَّ أَجِرْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ «»  

هَذَا حَدِيثٌ صَحِيحٌ عَلَى شَرْطِ الشَّيْخَيْنِ وَلَمْ يُخَرِّجَاهُ على شرطهما

See similar narrations below:

Collected by Ibn Mājah, Ibn Ḥibbān, Bayhaqī
ibnmajah:773Muḥammad b. Bashhār

The Mesenger of Allah said: "When anyone of enters the mosque, let him send peace upon the Prophet, then let him say: 'Allahumma aftahli abwaba rahmatik (O Allah, open to me the gates of Your mercy).' And when he leaves, let him send peace upon the Prophet and say: 'Allahumma- simni minash-shaitanir-rajim (O Allah, protect me from the accursed Shaitan).'"  

ابن ماجة:٧٧٣حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ حَدَّثَنَا أَبُو بَكْرٍ الْحَنَفِيُّ حَدَّثَنَا الضَّحَّاكُ بْنُ عُثْمَانَ حَدَّثَنِي سَعِيدٌ الْمَقْبُرِيُّ عَنْ أَبِي هُرَيْرَةَ

أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ وَلْيَقُلِ اللَّهُمَّ اعْصِمْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ  

ذِكْرُ مَا يَقُولُ الْمَرْءُ عِنْدَ دُخُولِ الْمَسْجِدِ يُرِيدُ الصَّلَاةَ

ibnhibban:2047ʿAbdullāh b. Muḥammad al-Azdī > Isḥāq b. Ibrāhīm

The Mesenger of Allah said: "When anyone of enters the mosque, let him send peace upon the Prophet, then let him say: 'Allahumma aftahli abwaba rahmatik (O Allah, open to me the gates of Your mercy).' And when he leaves, let him send peace upon the Prophet and say: 'Allahumma- simni minash-shaitanir-rajim (O Allah, protect me from the accursed Shaitan).'" (Using translation from Ibn Mājah 773)  

ابن حبّان:٢٠٤٧أَخْبَرَنَا عَبْدُ اللَّهِ بْنُ مُحَمَّدٍ الْأَزْدِيُّ قَالَ حَدَّثَنَا إِسْحَاقُ بْنُ إِبْرَاهِيمَ أَخْبَرَنَا أَبُو بَكْرٍ الْحَنَفِيُّ حَدَّثَنَا الضَّحَّاكُ بْنُ عُثْمَانَ عَنْ سَعِيدٍ الْمَقْبُرِيِّ عَنْ أَبِي هُرَيْرَةَ

عَنْ رَسُولِ اللَّهِ ﷺ قَالَ «إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ أَجِرْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ»  

ذِكْرُ الْأَمْرِ بِالِاسْتِجَارَةِ مِنَ الشَّيْطَانِ الرَّجِيمِ لِمَنْ خَرَجَ مِنَ الْمَسْجِدِ

ibnhibban:2050Ibn Khuzaymah > Bundār

The Mesenger of Allah said: "When anyone of enters the mosque, let him send peace upon the Prophet, then let him say: 'Allahumma aftahli abwaba rahmatik (O Allah, open to me the gates of Your mercy).' And when he leaves, let him send peace upon the Prophet and say: 'Allahumma- simni minash-shaitanir-rajim (O Allah, protect me from the accursed Shaitan).'" (Using translation from Ibn Mājah 773)  

ابن حبّان:٢٠٥٠أَخْبَرَنَا ابْنُ خُزَيْمَةَ قَالَ حَدَّثَنَا بُنْدَارٌ قَالَ حَدَّثَنَا أَبُو بَكْرٍ الْحَنَفِيُّ قَالَ حَدَّثَنَا الضَّحَّاكُ بْنُ عُثْمَانَ قَالَ حَدَّثَنِي سَعِيدٌ الْمَقْبُرِيُّ عَنْ أَبِي هُرَيْرَةَ

أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ «إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ أَجِرْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ»  

bayhaqi:4321Muḥammad b. ʿAbdullāh al-Ḥāfiẓ > Abū al-ʿAbbās Muḥammad b. Yaʿqūb > Muḥammad b. Sinān al-Qazzāz from my father

"The Messenger of Allah said: 'When anyone of you enters the mosque, let him send peace upon the prophet, then let him say: "Allahummaftah li abwaba rahmatika (O Allah, open to me the gates of Your mercy)." And when he leaves, let him say: "Allahumma inni as'aluka min fadlika. (O Allah, I ask of you from Your bounty)." (Using translation from Ibn Mājah 772)   

البيهقي:٤٣٢١أنبأ مُحَمَّدُ بْنُ عَبْدِ اللهِ الْحَافِظُ ثنا أَبُو الْعَبَّاسِ مُحَمَّدُ بْنُ يَعْقُوبَ ثنا مُحَمَّدُ بْنُ سِنَانٍ الْقَزَّازُ ثنا أَبُو بَكْرٍ عَبْدُ الْكَبِيرِ بْنُ عَبْدِ الْمَجِيدِ الْحَنَفِيُّ ثنا الضَّحَّاكُ بْنُ عُثْمَانَ حَدَّثَنِي سَعِيدٌ الْمَقْبُرِيُّ عَنْ أَبِي هُرَيْرَةَ ؓ

أَنَّ رَسُولَ اللهِ ﷺ قَالَ إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللهُمَّ أَجِرْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ