Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
muslim:389iḤarmalah b. Yaḥyá > Ibn Wahb > ʿAmr > ʿAbd Rabbih b. Saʿīd > ʿAbd al-Raḥman al-Aʿraj > Abū Hurayrah

The Messenger of Allah ﷺ said: The devil takes to his heels breaking wind when the prayer begins. and the rest is the same but with this addition:" He (the devil) makes him think of pleasant things (or things productive of enjoyment) and of the things wished for, and reminds him of such needs which he had forgotten."  

مسلم:٣٨٩iحَدَّثَنِي حَرْمَلَةُ بْنُ يَحْيَى حَدَّثَنَا ابْنُ وَهْبٍ أَخْبَرَنِي عَمْرٌو عَنْ عَبْدِ رَبِّهِ بْنِ سَعِيدٍ عَنْ عَبْدِ الرَّحْمَنِ الأَعْرَجِ عَنْ أَبِي هُرَيْرَةَ

أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ إِنَّ الشَّيْطَانَ إِذَا ثُوِّبَ بِالصَّلاَةِ وَلَّى وَلَهُ ضُرَاطٌ فَذَكَرَ نَحْوَهُ وَزَادَ فَهَنَّاهُ وَمَنَّاهُ وَذَكَّرَهُ مِنْ حَاجَاتِهِ مَا لَمْ يَكُنْ يَذْكُرُ