Hadith 11830

(حديث مرفوع) حَدَّثَنَا عَلِيُّ بْنُ عَيَّاشٍ ، حَدَّثَنَا مُحَمَّدُ بْنُ مُطَرِّفٍ ، حَدَّثَنَا زَيْدُ بْنُ أَسْلَمَ ، عَنْ عَطَاءِ بْنِ يَسَارٍ ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ ، قَالَ : قَالَ النَّبِيُّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " إِذَا شَكَّ أَحَدُكُمْ فِي صَلَاتِهِ ، فَلْيُلْقِ الشَّكَّ ، وَلْيَبْنِ عَلَى الْيَقِينِ ، وَلْيُصَلِّ سَجْدَتَيْنِ ، فَإِنْ كَانَتْ خَمْسًا شَفَعَ بِهِمَا ، وَإِنْ كَانَ صَلَّى أَرْبَعًا ، كَانَتَا تَرْغِيمًا لِلشَّيْطَانِ " .
It is narrated from Hazrat Abu Saeed Khudri (may Allah be pleased with him) that the Prophet (peace and blessings be upon him) said: When any one of you is praying and does not remember how many rak'ahs he has prayed, he should act on what he is certain of, and then while sitting, perform two prostrations of forgetfulness (sujood as-sahw). Because if his prayer was odd, it will become even, and if it was even, it will be a humiliation for Satan.
Hadith Reference مسند احمد / مسند المكثرين من الصحابة / 11830
Hadith Grading حکم دارالسلام: إسناده صحيح، م: 571