Praise be to Allah, the Lord of the Worlds; and may His blessings and peace be upon our Prophet Muhammad and upon all his Family and Companions.
Imam Muslim narrated from Othman that he came to Allah's messenger and said: "The Satan intervenes between me and my prayer and my reciting of the Qur'an and he confuses me. Thereupon, Allah's messenger said" That is(the doing of the Satan) who is known as Khinzab, and when you perceive its effect, seek refuge with Allah from it and spit three times to your left. I did that and Allah dispelled that from me." The Hadith contains some ways that protect one from satanic whispers.
The most important quality that could protect you from such disturbance is being steadfast, engrossing in the remembrance of Allah, and going early to perform prayers.
As long as you hate the thoughts and whispers that intervene in your prayer, they will not harm you . It is a sign of faith as narrated in the following Hadith: "Some companions came to the Prophet (Sallallahu Alaihi wa Sallam) and asked him, many dangerous whispers come to our minds we just cannot speak of them. The Prophet said, " really do you feel them? they said, 'yes', then the Prophet said: 'it is the sign of real faith'."
One should not heed to such whispers as the prophet said: "some people will keep asking you about knowledge until they say:" This is Allah (who created everything) but who created Allah? He who finds himself confronted with such a situation should say: I affirm my faith in Allah."
Imam Al Nawawi said explaining the above Hadith "whenever one faces such whispers, he should seek Allah's refuge, to resist them as much as possible, should not heed to them and should hasten to turn his attention to the good manners ".
Allah knows best.