Prayer

Malik :: Book 3 : Hadith 3.17.66

Yahya related to me from Malik from Zayd ibn Aslam from Ata ibn Yasar that the Messenger of Allah, may Allah bless him and grant him peace, said, "If you are uncertain in the prayer and do not know whether you have prayed three or four rakas, then pray a raka and make two prostrations from the sitting position before the taslim. If the raka that you prayed was the fifth, then you make it even by these two sajdas, and if it was the fourth, then the two prostrations spite Shaytan."

Source materials are from the University of Southern California MSA site
Hadith eBooks converted from Imaan Star