‘Abdullah, the son of Sinan, is reported to have said:

I mentioned to al-Sadiq (AS) about a man who was troubled by waswas (whisperings from Shaytan) in his Wudhu and Prayer, adding that he is a man of intelligence. Thereupon al-Sadiq (AS) said: ‘What kind of intelligence has he, when he obeys Shaytan?’ I said: ‘How does he obey Shaytan?’ The Imam replied, ‘Ask him regarding its cause and he will tell you that it is a work of Shaytan’.
(al-Kulayni, Usul al-Kafi, i, Kitab al-Aql Wal-Jahl, Tradition 10)

In al-Kafi (al-Kulayni (RA) reports) from Zurarah and Abu Basir that they said:

“We asked him (i.e. al-Baqir or al-Sadiq (AS) about a man who had frequent doubts in his Prayer, to the extent that he wouldn’t know how much he has offered and how much remains to be offered. He said,‘He should repeat (the Prayer)’. We said to him, ‘That happens to him a lot and wherever he repeats his doubt also recurs.’ The Imam said, ‘(In that case) he should ignore his doubt’. The Imam then added,

‘Do not let the evil one get accustomed to haunting him by tempting him to break the Prayer. For Shaytan is wicked and gets accustomed to that which he gets used to. So when one of you does not pay attention to his doubt and does not break his Prayer frequently, and this is done a number of times, the doubt will not recur to him’.”

Then the Imam added, ‘The evil one wants to be obeyed, and when he is disobeyed he will not return to any of you.’

The assurance from the Aimmah (AS) is that if you do not permit Shaytan to enter your souls during Payer, then he has no power to divert your attention during Prayer. He (i.e. The Prophet (S) said,Shaytan lays his snout, which is like the snout of a pig on the heart of the son of Adam, and instigates him to turn towards the world and that which God has not made lawful. But when a person remembers Allah, Shaytan slinks away.
(Majma’ al-bahrayn, Page 305)

Further, since Certainty, Conviction, Tranquillity, Steadiness, and Sincerity of the heart are caused by divine inspiration and angelic suggestions, you ought to pray to the Almighty for His divine deliverance and assistance during Prayer.

al-Sadiq (AS) has said:

A man came to The Prophet of Allah (S) and said: ‘O Prophet of Allah, I complain to you concerning the whisperings from Shaytan that so troubles me during Prayer that I don’t know how much of my prayer I have offered.’ The Prophet (S) said to him:

‘When you enter the state of Prayer, strike your left thigh with the forefinger of your right hand, then say:“In the Name of Allah and by Allah, I put my trust in God, I seek refuge in God, the All-hearing, the All-knowing from Shaytan, the Stoned One.” You will exorcise him (Shaytan) and drive him away’.”