Anas bin Malik reported: When the Messenger of Allah ﷺ entered the toilet, he used to say (before entering): "O Allaah, I seek refuge in Thee. " This is according to the version of Hammad. Abd al-Warith has another version: "I seek refuge in Allaah from male and female devils. "
Hadith Referenceسنن ابي داود / كتاب الطهارة / 4
Hadith Gradingالألبانی:صحيح | زبیر علی زئی:صحيح بخاري (142) صحيح مسلم (375)
Another tradition on the authority of Anas has: " O Allaah, I seek refuge in Thee. " Shubah said: Anas sometimes reported the words: "I take refuge in Allah. "
Hadith Referenceسنن ابي داود / كتاب الطهارة / 5
Hadith Gradingالألبانی:شاذ | زبیر علی زئی:إسناده صحيح
Hadith Takhrij« صحیح البخاری/الوضوء 9 (142)، الدعوات 15 (6322)، سنن الترمذی/الطہارة 4 (5)، (تحفة الأشراف: 1022)، وقد أخرجہ: مسند احمد (3/282) (شاذ) » (یعنی وہیب کی قولی روایت شاذ ہے، باقی صحیح ہے)
Narrated Zayd ibn Arqam: The Messenger of Allah ﷺ said: These privies are frequented by the jinns and devils. So when anyone amongst you goes there, he should say: "I seek refuge in Allah from male and female devils. "
Hadith Referenceسنن ابي داود / كتاب الطهارة / 6
Hadith Gradingالألبانی:صحيح | زبیر علی زئی:إسناده صحيح, مشكوة المصابيح (357)
Hadith Takhrij« سنن ابن ماجہ/الطھارة 9 (296)، سنن النسائی/الیوم واللیلة (75، 76)، (تحفة الأشراف: 3685)، وقد أخرجہ: مسند احمد (4/369، 373) (صحیح) »