ذِكْرُ الْأَمْرِ بِالِاسْتِجَارَةِ مِنَ الشَّيْطَانِ الرَّجِيمِ لِمَنْ خَرَجَ مِنَ الْمَسْجِدِ
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)
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ «إِذَا دَخَلَ أَحَدُكُمُ الْمَسْجِدَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ افْتَحْ لِي أَبْوَابَ رَحْمَتِكَ وَإِذَا خَرَجَ فَلْيُسَلِّمْ عَلَى النَّبِيِّ ﷺ وَلْيَقُلِ اللَّهُمَّ أَجِرْنِي مِنَ الشَّيْطَانِ الرَّجِيمِ»