In the case of a beginner in the art of spiritual warfare, God alone can expel thoughts, for it is only those strong in such warfare who are in a position to wrestle with them and banish them. Yet even they do not achieve this by themselves, but they fight against them with God’s assistance, clothed in the armor of His grace. So when thoughts invade you, in place of weapons call on the Lord Jesus frequently and persistently and then they will retreat; for they cannot bear the warmth produced in the heart by prayer and they flee as if scorched by fire.
St John Klimakos tells us, “Lash your enemies with the name of Jesus”, because God is a fire that cauterizes wickedness (cf. Deuteronomy 4:24; Hebrews 12:29). The Lord is prompt to help, and will speedily come to the defense of those who wholeheartedly call on Him day and night (cf. Luke 18:7).
But if prayer is not yet activated in you, you can put these thoughts to flight in another manner, by imitating Moses (cf. Exodus 17:11-12): rise up, lift hands and eyes to heaven, and God will rout them. Then sit down again and begin to pray resolutely. This is what you should do if you have not yet acquired the power of prayer. Yet even if prayer is activated in you and you are attacked by the more obdurate and grievous of the bodily passions–namely, listlessness and lust–you should sometimes rise up and lift your hands for help against them. But you should do this only seldom, and then sit down again, for there is a danger of the enemy deluding you by showing you some illusory form of truth. For only in those who are pure and perfect does God keep the intellect steadfast and intact wherever it is, whether above or below, or in the heart.
~St Gregory of Sinai (Philokalia, vol.4, pp.277-278)