Pray since He is in you & is with you always, and thus have access to your thoughts.
Psalm 19:12 Who can understand his errors? cleanse thou me from secret faults. 13 Keep back thy servant also from presumptuous sins; let them not have dominion over me: then shall I be upright, and I shall be innocent from the great transgression. 14 Let the words of my mouth, and the meditation of my heart, be acceptable in thy sight, O Lord, my strength, and my redeemer.
Hebrews 4:12 For the word of God is quick, and powerful, and sharper than any twoedged sword, piercing even to the dividing asunder of soul and spirit, and of the joints and marrow, and is a discerner of the thoughts and intents of the heart. 13 Neither is there any creature that is not manifest in his sight: but all things are naked and opened unto the eyes of him with whom we have to do. 14 Seeing then that we have a great high priest, that is passed into the heavens, Jesus the Son of God, let us hold fast our profession. 15 For we have not an high priest which cannot be touched with the feeling of our infirmities; but was in all points tempted like as we are, yet without sin. 16 Let us therefore come boldly unto the throne of grace, that we may obtain mercy, and find grace to help in time of need.
It is because of this, prayer is needed.
Ephesians 6: 10 Finally, my brethren, be strong in the Lord, and in the power of his might. 11 Put on the whole armour of God, that ye may be able to stand against the wiles of the devil. 12 For we wrestle not against flesh and blood, but against principalities, against powers, against the rulers of the darkness of this world, against spiritual wickedness in high places. 13 Wherefore take unto you the whole armour of God, that ye may be able to withstand in the evil day, and having done all, to stand.
It is one thing to cast down every wicked imagination but it is by His help...
2 Corinthians 10:4 (For the weapons of our warfare are not carnal, but mighty through God to the pulling down of strong holds
5 Casting down imaginations, and every high thing that exalteth itself against the knowledge of God, and bringing into captivity every thought to the obedience of Christ; 6 And having in a readiness to revenge all disobedience, when your obedience is fulfilled.
And another to think on good things with His help;
Philippian 4:6 Be careful for nothing; but in every thing by prayer and supplication with thanksgiving let your requests be made known unto God. 7 And the peace of God, which passeth all understanding, shall keep your hearts and minds through Christ Jesus. 8 Finally, brethren, whatsoever things are true, whatsoever things are honest, whatsoever things are just, whatsoever things are pure, whatsoever things are lovely, whatsoever things are of good report; if there be any virtue, and if there be any praise, think on these things. 9 Those things, which ye have both learned, and received, and heard, and seen in me, do: and the God of peace shall be with you.