2. Ṣalāh (Ritual Prayer)
٢۔ كتاب الصلاة
when one of you is in doubt about his prayer (i.e, how much he has prayed), he should throw away his doubt and base his prayer on what he is sure of. When he is sure about the completion of his prayer, he should make two prostrations (at the end of the prayer). If the prayer is complete, the additional rak’ah and the two prostrations will be supererogatory prayer. If the prayer is incomplete, the additional rak’ahs will compensate it, and the two prostrations will be a disgrace for the devil.
قَالَ رَسُولُ اللَّهِ ﷺ إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَلْيُلْقِ الشَّكَّ وَلْيَبْنِ عَلَى الْيَقِينِ فَإِذَا اسْتَيْقَنَ التَّمَامَ سَجَدَ سَجْدَتَيْنِ فَإِنْ كَانَتْ صَلاَتُهُ تَامَّةً كَانَتِ الرَّكْعَةُ نَافِلَةً وَالسَّجْدَتَانِ وَإِنْ كَانَتْ نَاقِصَةً كَانَتِ الرَّكْعَةُ تَمَامًا لِصَلاَتِهِ وَكَانَتِ السَّجْدَتَانِ مُرْغِمَتَىِ الشَّيْطَانِ
The Prophet ﷺ named the two prostrations of forgetfulness disgraceful for the devil.
أَنَّ النَّبِيَّ ﷺ سَمَّى سَجْدَتَىِ السَّهْوِ الْمُرْغِمَتَيْنِ
The Prophet ﷺ said: When one of you is in doubt about his prayer, and does not know how much he has prayed, three or four rak'ahs, he should pray one (additional) rak'ah and make two prostrations while sitting before giving the salutation. If the (additional) rak'ah which he prayed is the fifth one, he will make it an even number by these two prostrations. If it is the fourth one, the two prostrations will be a disgrace for the devil.
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَلاَ يَدْرِي كَمْ صَلَّى ثَلاَثًا أَوْ أَرْبَعًا فَلْيُصَلِّ رَكْعَةً وَيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ قَبْلَ التَّسْلِيمِ فَإِنْ كَانَتِ الرَّكْعَةُ الَّتِي صَلَّى خَامِسَةً شَفَعَهَا بِهَاتَيْنِ وَإِنْ كَانَتْ رَابِعَةً فَالسَّجْدَتَانِ تَرْغِيمٌ لِلشَّيْطَانِ
The Prophet ﷺ said: If one of you is in doubt about his prayer, and if he is sure that he prayed three rak'ah, he should stand and complete one rak'ah along with its prostrations. Then he should sit and recite the tashahhud. When he finishes the prayer, and there remains nothing except salutation, he should make two prostrations while he is sitting and afterwards should give the salutation. The narrator then narrated the tradition similar to that of Malik. Abu Dawud said: Similarly, this tradition has been narrated by Ibn Wahb from Malik, Hafs b. Maisarah, Dawud b. Qais and Hisham b. Sa'd. But Hisham projected it to Abu Sa'id al-Khudri.
إِنَّ النَّبِيَّ ﷺ قَالَ إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَإِنِ اسْتَيْقَنَ أَنْ قَدْ صَلَّى ثَلاَثًا فَلْيَقُمْ فَلْيُتِمَّ رَكْعَةً بِسُجُودِهَا ثُمَّ يَجْلِسْ فَيَتَشَهَّدْ فَإِذَا فَرَغَ فَلَمْ يَبْقَ إِلاَّ أَنْ يُسَلِّمَ فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ ثُمَّ لْيُسَلِّمْ ثُمَّ ذَكَرَ مَعْنَى مَالِكٍ