It was narrated from Abu Umamah that:
The Messenger of Allah (ﷺ) said: "None of you should fail to say, when he enters his toilet: 'Allahumma inni a`udhu bika minar-rijsin-najis, al-khabithil-mukhbith, ash-Shaitanir-rajim (O Allah, I seek refuge with You from the filthy and impure, the evil one with evil companions, the accursed Shaitan).'" (Da'if)
Another chain with a slightly different wording from Ibn Abi Maryam who mentioned similar, but he did not say in his narration: "Minar-rijsin-najis (From the filthy and the impure)" he only said: "Minal-khabithil-mukhbith, ash-Shaitanir-rajim (From the evil one with evil companions, the accursed Shaitan)."
حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، وَعَبْدُ الرَّحْمَنِ بْنُ مَهْدِيٍّ، قَالاَ حَدَّثَنَا شُعْبَةُ، عَنْ قَتَادَةَ، عَنِ النَّضْرِ بْنِ أَنَسٍ، عَنْ زَيْدِ بْنِ أَرْقَمَ، قَالَ قَالَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ " إِنَّ هَذِهِ الْحُشُوشَ مُحْتَضَرَةٌ فَإِذَا دَخَلَ أَحَدُكُمْ فَلْيَقُلِ اللَّهُمَّ إِنِّي أَعُو…
It was narrated that Zaid bin Arqam said:
"The Messenger of Allah (ﷺ) said: 'These Hushush (waste areas) are visited (by devils), so when anyone of you enters, let him say: 'Allahumma inni a`udhu bika minal-khubthi wal-k…
It was narrated that 'Ali said:
"The Messenger of Allah (ﷺ) said: 'The screen between the Jinn and the nakedness of the sons of Adam is that when a person enters the Kanif, he should say: Bismillah (in the name of Allah)…
حَدَّثَنَا عَمْرُو بْنُ رَافِعٍ، حَدَّثَنَا إِسْمَاعِيلُ ابْنُ عُلَيَّةَ، عَنْ عَبْدِ الْعَزِيزِ بْنِ صُهَيْبٍ، عَنْ أَنَسِ بْنِ مَالِكٍ، قَالَ كَانَ رَسُولُ اللَّهِ ـ صلى الله عليه وسلم ـ إِذَا دَخَلَ الْخَلاَءَ قَالَ " أَعُوذُ بِاللَّهِ مِنَ الْخُبُثِ وَالْخَبَائِثِ " .
It was narrated that Anas bin Malik said:
"Whenever the Messenger of Allah (ﷺ) entered the toilet, he would say: 'A'udhu Billahi minal-khubthi wa'l-khaba'ith (I seek refuge with Allah from male and female devils).'"