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.
ahmad:11830ʿAlī b. ʿAyyāsh > Muḥammad b. Muṭarrif > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd al-Khudrī

[Machine] The Prophet ﷺ said, "If anyone of you has doubts about his prayer, he should cast aside the doubt and be certain about it, and then offer two prostrations (sajdahs). If he prayed five obligatory prayers, by offering these two prostrations, they will complete them. However, if he prayed four sunnah prayers, they will be an admonition to the devil."  

أحمد:١١٨٣٠حَدَّثَنَا عَلِيُّ بْنُ عَيَّاشٍ حَدَّثَنَا مُحَمَّدُ بْنُ مُطَرِّفٍ حَدَّثَنَا زَيْدُ بْنُ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ قَالَ

قَالَ النَّبِيُّ ﷺ إِذَا شَكَّ أَحَدُكُمْ فِي صَلَاتِهِ فَلْيُلْقِ الشَّكَّ وَلْيَبْنِ عَلَى الْيَقِينِ وَلْيُصَلِّ سَجْدَتَيْنِ فَإِنْ كَانَتْ خَمْسًا شَفَعَ بِهِمَا وَإِنْ كَانَ صَلَّى َأَرْبَعًا كَانَتَا تَرْغِيمًا لِلشَّيْطَانِ  


See similar narrations below:

Collected by Muslim, Nasāʾī, Bayhaqī, Suyūṭī
muslim:571aMuḥammad b. Aḥmad b. Abū Khalaf > Mūsá b. Dāwud > Sulaymān b. Bilāl > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd al-Khudrī

The Messenger of Allah ﷺ said: When any one of you is in doubt about his prayer and he does Dot know how much he has prayed, three or four (rak'ahs). he should cast aside his doubt and base his prayer on what he is sure of. then perform two prostrations before giving salutations. If he has prayed five rak'ahs, they will make his prayer an even number for him, and if he has prayed exactly four, they will be humiliation for the devil.  

مسلم:٥٧١aوَحَدَّثَنِي مُحَمَّدُ بْنُ أَحْمَدَ بْنِ أَبِي خَلَفٍ حَدَّثَنَا مُوسَى بْنُ دَاوُدَ حَدَّثَنَا سُلَيْمَانُ بْنُ بِلاَلٍ عَنْ زَيْدِ بْنِ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ قَالَ

قَالَ رَسُولُ اللَّهِ ﷺ إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَلَمْ يَدْرِ كَمْ صَلَّى ثَلاَثًا أَمْ أَرْبَعًا فَلْيَطْرَحِ الشَّكَّ وَلْيَبْنِ عَلَى مَا اسْتَيْقَنَ ثُمَّ يَسْجُدُ سَجْدَتَيْنِ قَبْلَ أَنْ يُسَلِّمَ فَإِنْ كَانَ صَلَّى خَمْسًا شَفَعْنَ لَهُ صَلاَتَهُ وَإِنْ كَانَ صَلَّى إِتْمَامًا لأَرْبَعٍ كَانَتَا تَرْغِيمًا لِلشَّيْطَانِ  

nasai:1238Yaḥyá b. Ḥabīb b. ʿArabī > Khālid > Ibn ʿAjlān > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd

The Prophet ﷺ said: "If one of you is not sure about his prayer, let him forget about what he is unsure of and complete his prayer on the basis of what he is sure of. When he is sure that he has completed it, let him prostrate twice while he is sitting. Then if he has prayed five (rak'ahs), they (the two prostrations) will make his prayer even-numbered, and if he had prayed four, they will annoy and humiliate the shaitan."  

النسائي:١٢٣٨أَخْبَرَنَا يَحْيَى بْنُ حَبِيبِ بْنِ عَرَبِيٍّ قَالَ حَدَّثَنَا خَالِدٌ عَنِ ابْنِ عَجْلاَنَ عَنْ زَيْدِ بْنِ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنْ أَبِي سَعِيدٍ

عَنِ النَّبِيِّ ﷺ قَالَ إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَلْيُلْغِ الشَّكَّ وَلْيَبْنِ عَلَى الْيَقِينِ فَإِذَا اسْتَيْقَنَ بِالتَّمَامِ فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ قَاعِدٌ فَإِنْ كَانَ صَلَّى خَمْسًا شَفَعَتَا لَهُ صَلاَتَهُ وَإِنْ صَلَّى أَرْبَعًا كَانَتَا تَرْغِيمًا لِلشَّيْطَانِ  

bayhaqi:3826Abū Ḥāzim ʿUmar b. Aḥmad al-Ḥāfiẓ > Abū Aḥmad al-Ḥāfiẓ > Abū al-Ḥasan Aḥmad b. ʿUmayr b. Yūsuf al-Dimashqī Bidimashq > Muḥammad b. And Zīr / Ibn al-Ḥakam al-Sulamī > al-Walīd b. Muslim > Wataʾawwal Mālik b. Anas Mā > Zayd b. Aslam > ʿAṭāʾ b. Yasār > Abū Saʿīd al-Khudrī

[Machine] The Messenger of Allah ﷺ said, "If any of you have doubt about his prayer, he should not know whether he prayed three or four units (rak'ahs). He should dismiss the doubt and be certain. Then he should perform two prostrations before making the tasleem (saying salaam at the end of the prayer). If it is an odd number of units, he should make it an intercessory one through these two prostrations, and if it is an even number, these two prostrations become a means of rebuke for Satan."  

البيهقي:٣٨٢٦أَخْبَرَنَاهُ أَبُو حَازِمٍ عُمَرُ بْنُ أَحْمَدَ الْحَافِظُ أنبأ أَبُو أَحْمَدَ الْحَافِظُ أنبأ أَبُو الْحَسَنِ أَحْمَدُ بْنُ عُمَيْرِ بْنِ يُوسُفَ الدِّمَشْقِيُّ بِدِمَشْقَ ثنا مُحَمَّدُ بْنُ وَزِيرٍ يَعْنِي ابْنَ الْحَكَمِ السُّلَمِيَّ ثنا الْوَلِيدُ بْنُ مُسْلِمٍ قَالَ وَتَأَوَّلَ مَالِكُ بْنُ أَنَسٍ مَا أَخْبَرَنَا هُوَ عَنْ زَيْدِ بْنِ أَسْلَمَ عَنْ عَطَاءِ بْنِ يَسَارٍ عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ قَالَ

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

suyuti:2040a

The Messenger of Allah ﷺ said: When any one of you is in doubt about his prayer and he does Dot know how much he has prayed, three or four (rak'ahs). he should cast aside his doubt and base his prayer on what he is sure of. then perform two prostrations before giving salutations. If he has prayed five rak'ahs, they will make his prayer an even number for him, and if he has prayed exactly four, they will be humiliation for the devil. (Using translation from Muslim 571a)   

السيوطي:٢٠٤٠a

"إذا شكَّ أحدُكُمْ في صلاتِه فلمْ يَدْرِ كم صلَّى، ثلاثًا أمْ أربْعًا؟ فليَطرحْ الشَّكَ ولْيبْنِ على ما اسْتيقَنَ ثُمَّ يَسْجُدْ سجْدَتين قْبلَ أنْ يُسلِّمَ، فإِن كانَ صلَّى خمسًا شَفعْن له صَلاته، وإنْ كانَ صلَّى إتْمامًا لأربعٍ كانتا تَرْغيما للشَّيطان".  

[ش] ابن أبى شيبة [حم] أحمد [م] مسلم [د] أبو داود [ن] النسائي [هـ] ابن ماجة عن أبي سعيد- مالك وعبد الرزاق عن عطاء بن يسار مرسلًا