Narration by Abdullah bin Amr (may Allah be pleased with him):
Abdullah bin Amr (رضی اللہ عنہ) reported that when the Prophet Muhammad (صلی اللہ علیہ وسلم) entered the mosque, he would recite the following prayer:
“I seek refuge in Allah the Great, in His Noble Face, and in His Eternal Sovereignty from the accursed Satan.”
(Sunan Abi Dawood: 466, and its chain is authentic)
Additionally, the Prophet (صلی اللہ علیہ وسلم) mentioned that when someone recites this prayer, Satan says:
“This person has been protected from me for the entire day.”
Narration by Abu Hurairah (may Allah be pleased with him):
Abu Hurairah (رضی اللہ عنہ) narrated that the Messenger of Allah (صلی اللہ علیہ وسلم) said:
“When someone enters the mosque, they should send salutations upon the Prophet (صلی اللہ علیہ وسلم) and then recite the following prayer:”
“O Allah! Open the doors of Your mercy for me.”
“And when someone exits the mosque, they should send salutations upon the Prophet (صلی اللہ علیہ وسلم) and recite the following prayer:”
“O Allah! Protect me from the accursed Satan.”
(Sunan Ibn Majah: 773, and its chain is authentic)
Note:
Before reciting these prayers, one should say:
“Peace be upon the Messenger of Allah.”