We must depend on the Spirit's power to control our thoughts. Here is what the Scriptures have to say on that point: "The weapons of our warfare are not carnal, but mighty through God [the indwelling Holy Spirit].... bringing into captivity every thought to the obedience of Christ" (2 Cor. 10:4,5).
Only the Spirit of God can make this possible in our lives, and He does it only when we are under His complete control.
When an evil thought comes to our mind, what are we to do? We should turn it over to the Spirit and ask Him to take charge. I have personally done this for years. It is the only method that works for me.
I cannot help it when a thought comes, whether it is good or bad. I do not, however, have to dwell on that thought. So the moment a wrong thought comes, I ask the Holy Spirit to take over, for that is His responsibility.
When I give Him control, He gives me victory. I have experienced this thousands of times.
Thoughts that come to our mind can also be the Holy Spirit's reminder to pray. In I Thessalonians 5:17 we are told to pray without ceasing. Can we possibly do that? Only by letting the Holy Spirit control us.
As He dwells in us and we continue to give Him control so that no sin hinders His working in our hearts, He reminds us of the things He wants us to pray about.
"And be renewed in the spirit of your mind" (Eph. 4:23).