سنن ابن ماجه Sunan Ibn Majah كتاب إقامة الصلاة والسنة Establishing the Prayer and the Sunnah Regarding Them
. بَابُ : مَا جَاءَ فِيمَنْ شَكَّ فِي صَلاَتِهِ فَرَجَعَ إِلَى الْيَقِينِ

Chapter: What was narrated concerning one who is uncertain about his Prayer; let him refer to what is more certain

2 hadith
Hadith 1209
حَدَّثَنَا أَبُو يُوسُفَ الرَّقِّيُّ مُحَمَّدُ بْنُ أَحْمَدَ الصَّيْدَلَانِيُّ ، حَدَّثَنَا مُحَمَّدُ بْنُ سَلَمَةَ ، عَنْ مُحَمَّدِ بْنِ إِسْحَاق ، عَنْ مَكْحُولٍ ، عَنْ كُرَيْبٍ ، عَنْ ابْنِ عَبَّاسٍ ، عَنْ عَبْدِ الرَّحْمَنِ بْنِ عَوْفٍ ، قَالَ : سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ : " إِذَا شَكَّ أَحَدُكُمْ فِي الثِّنْتَيْنِ وَالْوَاحِدَةِ فَلْيَجْعَلْهَا وَاحِدَةً ، وَإِذَا شَكَّ فِي الثِّنْتَيْنِ وَالثَّلَاثِ فَلْيَجْعَلْهَا ثِنْتَيْنِ ، وَإِذَا شَكَّ فِي الثَّلَاثِ وَالْأَرْبَعِ فَلْيَجْعَلْهَا ثَلَاثًا ، ثُمَّ لِيُتِمَّ مَا بَقِيَ مِنْ صَلَاتِهِ حَتَّى يَكُونَ الْوَهْمُ فِي الزِّيَادَةِ ، ثُمَّ يَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ قَبْلَ أَنْ يُسَلِّمَ " .
´It was narrated that ‘Abdur-Rahman bin ‘Awf said:` “I heard the Messenger of Allah (ﷺ) say: ‘If anyone of you is uncertain as to whether he has prayed one or two Rak’ah, let him assume it is one. If he is uncertain as to whether he has prayed two or three, let him assume it is two. If he is uncertain as to whether he has prayed three or four, let him assume it is three. Then let him complete what is left of his prayer, so that the doubt will be about what is more. Then let him prostrate twice while he is sitting, before the Taslim (saying the Salam).’”
Hadith Reference Sunan Ibn Majah / Establishing the Prayer and the Sunnah Regarding Them / Hadith: 1209
Hadith Grading الألبانی: صحيح  |  زبیر علی زئی: حسن
Hadith Takhrij « سنن الترمذی/الصلاة 175 ( 398 ) ، ( تحفة الأشراف : 9722 ) ، وقد أخرجہ : مسند احمد ( 1/190 ، 193 ، 195 ) ( صحیح ) »
Hadith 1210
حَدَّثَنَا أَبُو كُرَيْبٍ ، حَدَّثَنَا أَبُو خَالِدٍ الْأَحْمَرُ ، عَنْ ابْنِ عَجْلَانَ ، عَنْ زَيْدِ بْنِ أَسْلَمَ ، عَنْ عَطَاءِ بْنِ يَسَارٍ ، عَنْ أَبِي سَعِيدٍ الْخُدْرِيِّ ، قَالَ : قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " إِذَا شَكَّ أَحَدُكُمْ فِي صَلَاتِهِ ، فَلْيُلْغِ الشَّكَّ وَلْيَبْنِ عَلَى الْيَقِينِ ، فَإِذَا اسْتَيْقَنَ التَّمَامَ سَجَدَ سَجْدَتَيْنِ ، فَإِنْ كَانَتْ صَلَاتُهُ تَامَّةً كَانَتِ الرَّكْعَةُ نَافِلَةً ، وَإِنْ كَانَتْ نَاقِصَةً كَانَتِ الرَّكْعَةُ لِتَمَامِ صَلَاتِهِ ، وَكَانَتِ السَّجْدَتَانِ رَغْمَ أَنْفِ الشَّيْطَانِ " .
´It was narrated that Abu Sa’eed Al-Khudri said:` “The Messenger of Allah (ﷺ) said: ‘If anyone of you is uncertain about his prayer, let him put aside uncertainty and act upon that which is certain. When he has made sure his prayer is complete, then let him prostrate twice. Then if his prayer was complete, that (extra) Rak’ah will be counted as voluntary, and if his prayer was lacking, that Rak’ah will complete his prayer, and the two prostrations will rub the Satan’s nose in the dust.’”
Hadith Reference Sunan Ibn Majah / Establishing the Prayer and the Sunnah Regarding Them / Hadith: 1210
Hadith Grading الألبانی: حسن صحيح  |  زبیر علی زئی: صحيح مسلم
Hadith Takhrij « صحیح مسلم/المساجد 19 ( 571 ) ، سنن ابی داود/الصلاة 197 ( 1024 ، 1027 ) ، سنن النسائی/السہو 42 ( 1239 ، 1240 ) ( تحفة الأشراف : 4163 ) ، وقد أخرجہ : موطا امام مالک/الصلاة16 ( 62 ) ، مسند احمد ( 3/72 ، 83 ، 84 ، 87 ) سنن الدارمی/الصلاة 174 ( 1536 ) ( حسن صحیح ) »