How Do You Stay Focused While Praying?
Question

If a person praying experiences insinuating thoughts from Shaytan in his prayer, causing him problems in reciting the Quran, and resulting in bad or evil thoughts, and making him doubt the number of completed rak’ahs, what should he do?
Praise be to Allah.Satanic whispers during prayer 

This happened to one of the Companions of the Prophet (blessings and peace be upon him) whose name is ‘Uthman ibn Abi Al-’As, (may Allah be pleased with him). ’Uthman came complaining to the Prophet (peace and blessings be upon him), and said: "The Shaytan comes between me and my prayer and causes me problems with my recitation." So the Messenger of Allah (peace and blessings be upon him) said: "That is a Shaytan called Khanzab , so if you feel his presence, seek refuge in Allah and blow a mist to your left three times." He said: "I applied this advice and Allah has rid me of him.” (Sahih Muslim, 2203) 
Tips on how to stay focused in prayer
This hadith includes two ways on how to get rid of the shaytan while praying .

Seeking refuge in Allah from the Shaytan's evil by pronouncing the words of seeking refuge and this is OK in this case. 
Blowing with mist to the left three times. This is basically blowing air in a similar manner to spitting, but with a minute mist of saliva, on the condition that this does not disturb or bother the person next to him, nor make the masjid dirty.

And Allah knows best.
Reference: “What Should You Do in the Following Situations by Sheikh Muhammad Salih Al-Munajjid.