Sunan Abi Dawud 1027
Grading supplied with this record: Sahih (Al-Albani)
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَإِنِ اسْتَيْقَنَ أَنْ قَدْ صَلَّى ثَلاَثًا فَلْيَقُمْ فَلْيُتِمَّ رَكْعَةً بِسُجُودِهَا ثُمَّ يَجْلِسْ فَيَتَشَهَّدْ فَإِذَا فَرَغَ فَلَمْ يَبْقَ إِلاَّ أَنْ يُسَلِّمَ فَلْيَسْجُدْ سَجْدَتَيْنِ وَهُوَ جَالِسٌ ثُمَّ لْيُسَلِّمْ "
Zaid b. Aslam reported on the authority of the chain of Malik:
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.
Full reference and source
Sunan Abi Dawud 1027 In-book : Book 2, Hadith 638 English translation : Book 3, Hadith 1022
View source on Sunnah.com (opens in a new tab)