Courtesy of ISL Software, makers of the WinAlim Islamic database.
Book 4, Number 4.1.2:Yahya related to me from Malik from Ibn Shihab from Abu Salama ibn Abdar-Rahman ibn Awf from Abu Hurayra that the Messenger of Allah, may Allah bless him and grant him peace, said, "When you stand in prayer, Shaytan comes to you and confuses you until you do not know how much you have prayed. If you find that happening do two sajdas from the sitting position."
Book 4, Number 4.1.3:Yahya related to me from Malik that he had heard that the Messenger of Allah, may Allah bless him and grant him peace, said, "I forget or I am made to forget so that I may establish the sunna."
Yahya related to me from Malik that he had heard that a man questioned al-Qasim ibn Muhammad saying, "My imagination works in the prayer, and it happens to me a lot." Al-Qasim ibn Muhammad said, "Go on with your prayer, for it will not goaway from you until you goaway saying, 'I have not completed my prayer.' "