Al-Ilmam bi-Ahadith al-Ahkam 259
وَرَوَى عَلْقَمَة، قَالَ: قَالَ عبد الله: صَلَّى لنا رَسُول الله ﷺ قَالَ إِبْرَاهِيم: زَاد أَو نقص فَذكر الحَدِيث وَفِيه: " إِذا شكّ أحدكُم فِي صلَاته فليتحرَّ الصَّوَاب، فليتم عَلَيْهِ، (ثمَّ يسْجد سَجْدَتَيْنِ ". لفظ مُسلم) . وَعند أبي دَاوُد: " فليتم عَلَيْهِ، ثمَّ ليسلم، ثمَّ ليسجد سَجْدَتَيْنِ " وَرِجَاله رجال الصَّحِيحَيْنِ ". (وَفِي رِوَايَة لمُسلم فَقَالَ: " إِذا زَاد الرجل أَو نقص فليسجد سَجْدَتَيْنِ ") .
And ʿAlqamah narrated; he said: ʿAbdullah said: The Messenger of Allah ﷺ led us in prayer — Ibrahim said: he added or omitted [something] — and he mentioned the hadith, and in it: "When one of you is in doubt in his prayer, let him aim for what is correct and complete [the prayer] on that basis, then prostrate twice." (The wording is Muslim's.) And with Abu Dawud: "Let him complete [the prayer] on that basis, then give the salam, then prostrate twice"; and its men are the men of the two Sahihs. (And in a narration of Muslim he said: "When a man adds or omits [something], let him prostrate twice.")