عَنْ عَامِرِ بْنِ رَبِيعَةَ رَضِيَ اللَّهُ عَنْهُ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ أَلَا لَا يَخْلُوَنَّ رَجُلٌ بِامْرَأَةٍ لَا تَحِلُّ لَهُ فَإِنَّ ثَالِثَهُمَا الشَّيْطَانُ إِلَّا مَحْرَمٌ فَإِنَّ الشَّيْطَانَ مَعَ الْوَاحِدِ وَهُوَ مِنَ الْاثْنَيْنِ أَبْعَدُ مَنْ سَاءَتْهُ سَيِّئَتُهُ وَسَرَّتْهُ حَسَنَتُهُ فَهُوَ مُؤْمِنٌ
It is narrated from Sayyiduna ‘Amir bin Rabi‘ah (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: Beware! No man should ever be alone with a woman who is not lawful for him, because the third one present is the devil, except in the case of a mahram. The devil is with one person and stays away from more than two. And whoever finds evil to be evil and good to be good, then he is a believer.