حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مُحَمَّدِ بْنِ عَبْدِ الْعَزِيزِ ، ثنا بِشْرُ بْنُ الْوَلِيدِ ، ثنا عَبْدُ الْعَزِيزِ بْنُ عَبْدِ اللَّهِ بْنِ أَبِي سَلَمَةَ ، عَنْ زَيْدِ بْنِ أَسْلَمَ ، عَنْ عَطَاءِ بْنِ يَسَارٍ ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ ، عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ ، قَالَ : " إِذَا لَمْ يَدْرِ أَحَدُكُمْ كَمْ صَلَّى ثَلاثًا أَوْ أَرْبَعًا فَلْيَقُمْ فَلْيُصَلِّ رَكْعَةً ثُمَّ يَسْجُدُ بَعْدَ ذَلِكَ سَجْدَتَيِ السَّهْوِ وَهُوَ جَالِسٌ ، فَإِنْ كَانَ صَلَّى خَمْسًا شَفَعَتَا لَهُ صَلاتَهُ ، وَإِنْ كَانَتْ أَرْبَعًا أَرْغَمَتَا أَنْفَ الشَّيْطَانِ " .
Sayyiduna Abu Sa'id Khudri (may Allah be pleased with him) narrates this statement of the Noble Prophet (peace and blessings be upon him): "When a person is unsure about how many rak'ahs he has performed, whether three or four, he should perform one more rak'ah and then perform two prostrations of forgetfulness (sajda sahw) after he is seated (i.e., while reciting the tashahhud). If he ends up performing five rak'ahs, then the even number (i.e., four rak'ahs) will be counted as his prayer, and if he has performed four rak'ahs, then these two (prostrations) will disgrace the Shaytan."