What is the ruling on sahw (forgetfulness) in prayer?
Question

What is the ruling on sahw (forgetfulness) in prayer when a person’s mind wanders without any intention on his part?
Praise be to Allah.When the time for prayer comes, the worshipper should forget about all worldly matters so that he can focus his mind and his thoughts on worshipping his Lord as much as he can. So when he purifies himself and stands to pray, he stands humbly, reciting the Book of his Lord or listening to it, pondering its meanings and the meanings of the adhkaar he recites in his prayers. He should not give in to the Shaytaan and his insinuating whispers; when the Shaytaan tries to distract him, he tries harder to focus on his prayers, and seeks refuge with Allah from the accursed Shaytaan. It was narrated from Abu’l-‘Alaa’ ibn al-Shukhayr that ‘Uthmaan said, “O Messenger of Allah, the Shaytaan comes between me and my prayer and recitation.” He [the Prophet (peace and blessings of Allah be upon him) said: “That is a shaytaan (devil) called Khanzab. If you feel him then seek refuge with Allah from him and spit drily to your left three times.” He ‘[Uthmaan] said: I did that and Allah kept him away from me.
 Narrated by Ahmad, 4/216; Muslim, 4/1728-1729; ‘Abd al-Razzaaq, 2/85, 499, no. 2582, 4220; Ibn Abi Shaybah, 7/419, 10/353; Ibn al-Sunni in ‘Aml al-Yawm wa’l-Laylah, p. 272, no. 577.
 And Allah is the source of strength. May Allah bless our Prophet Muhammad and his family and companions, and grant them peace.