Language:
كتاب بدء الخلق
59  
Beginning of Creation
(11)
Chapter: The characteristics of Iblis (Satan) and his soldiers
(11)
باب صِفَةِ إِبْلِيسَ وَجُنُودِهِ
Sahih al-Bukhari 3285

Narrated Abu Huraira:

The Prophet (ﷺ) said, "When the call for the prayer is pronounced, Satan takes to his heels, passing wind with noise, When the call for the prayer is finished, he comes back. And when the Iqama is pronounced, he again takes to his heels, and after its completion, he returns again to interfere between the (praying) person and his heart, saying to him. 'Remember this or that thing.' till the person forgets whether he has offered three or four rak`at: so if one forgets whether he has prayed three or four rak`at, he should perform two prostrations of Sahu (i.e. forgetfulness).

حَدَّثَنَا مُحَمَّدُ بْنُ يُوسُفَ، حَدَّثَنَا الأَوْزَاعِيُّ، عَنْ يَحْيَى بْنِ أَبِي كَثِيرٍ، عَنْ أَبِي سَلَمَةَ، عَنْ أَبِي هُرَيْرَةَ ـ رضى الله عنه ـ قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏ "‏ إِذَا نُودِيَ بِالصَّلاَةِ أَدْبَرَ الشَّيْطَانُ وَلَهُ ضُرَاطٌ، فَإِذَا قُضِيَ أَقْبَلَ، فَإِذَا ثُوِّبَ بِهَا أَدْبَرَ، فَإِذَا قُضِيَ أَقْبَلَ، حَتَّى يَخْطِرَ بَيْنَ الإِنْسَانِ وَقَلْبِهِ، فَيَقُولُ اذْكُرْ كَذَا وَكَذَا‏.‏ حَتَّى لاَ يَدْرِي أَثَلاَثًا صَلَّى أَمْ أَرْبَعًا فَإِذَا لَمْ يَدْرِ ثَلاَثًا صَلَّى أَوْ أَرْبَعًا سَجَدَ سَجْدَتَىِ السَّهْوِ ‏"‏‏.‏
Reference : Sahih al-Bukhari 3285
In-book reference : Book 59, Hadith 94
USC-MSA web (English) reference : Vol. 4, Book 54, Hadith 505
  (deprecated numbering scheme)