صحیح ابن حبان
Ibn Hibban
كتاب الصلاة
Book of Prayer
باب سجود السهو - ذكر البيان بأن الباني على الأقل إذا شك في صلاته عليه أن يسجد سجدتي السهو قبل الصلاة لا بعد
Chapter on Prostration of Forgetfulness - Clarification that one who builds on the lesser number in prayer when in doubt should prostrate before prayer, not after
1 hadith
Hadith 2667
Sayyiduna Abu Sa'id Khudri (may Allah be pleased with him) narrates that the Prophet Muhammad (peace and blessings be upon him) said: "When a person has doubt about his prayer, he should put the doubt aside and base his action on what he is certain of. When he becomes certain that his prayer is complete, he should perform two prostrations of forgetfulness (sajda sahw). If his prayer was complete, then that extra rak'ah will be counted as a voluntary (nafl) prayer and the two prostrations will also be voluntary. And if his prayer was incomplete, then that rak'ah will complete his prayer and the two prostrations will humiliate the devil."