Matthew 26:41 (KJV)
41 Watch and pray, that ye enter not into temptation: the spirit indeed is willing, but the flesh is weak.
Let the Lord take all your evil thoughts captive. Do not delay. The sooner you do this the better, lest you fall into sin.
Allow your thoughts to be conformed with God's. Seek His presence often and the Lord will help you withstand temptation.