Sahih al-Bukhari 1231
Book 22: Forgetfulness in Prayer · Hadith 9
Hadith text
Narrated Abu Huraira:Allah's Messenger (ﷺ) said, "When the call for prayer is made, Satan takes to his heels passing wind so that he may not hear the Adhan and when the call is finished he comes back, and when the Iqama is pronounced, Satan again takes to his heels, and when the Iqama is finished he comes back again and tries to interfere with the person and his thoughts and say, "Remember this and that (which he has not thought of before the prayer)", till the praying person forgets how much he has prayed. If anyone of you does not remember whether he has offered three or four rak`at then he should perform two prostrations of Sahu while sitting
Abu Huraira (رضی اللہ عنہ) bataate hain: Allah ke Rasool ne farmaya: "Jab namaz ki Adhan di jaati hai, shaitan hawa (paadta) chhodta hua bhaag jaata hai taake Adhan na sun sake, aur jab Adhan khatam hoti hai, woh wapas aa jaata hai; aur jab Iqama hoti hai, shaitan phir bhaag jaata hai, aur khatam hone par phir wapas aata hai aur namazi ko uske khayaalon mein rukawat daalne ki koshish karta hai aur kehta hai: 'Yeh yaad karo, woh yaad karo' (jo usne namaz se pehle nahi socha tha), yahan tak ke namazi bhool jaata hai usne kitni rakat padhi hain. Agar tum mein se koi yaad na rakh sake ke usne teen padhi ya chaar, use baithkar do Sahu ke sajde karne chahiye."
Sahih al-Bukhari 1231 · Book 22, Hadith 9