“How much influence does Satan have over my thoughts?” Liahona, April 2015, 61
Our Heavenly Father ensures that we have moral agency, the ability to choose good or evil. He won’t force us to do good, and the devil can’t force us to do evil (see Teachings of Presidents of the Church: Joseph Smith , 214).
So, when it comes to your thoughts, the devil has only as much influence as you’re willing to give him. The Prophet Joseph Smith said, “Satan cannot seduce us by his enticements unless we in our hearts consent and yield” (Teachings: Joseph Smith, 213). He also said, “The devil has no power over us only as we permit him” (214).
In addition, the scriptures tell us that “there is none else save God that knowest thy thoughts and the intents of thy heart” (D&C 6:16), so Satan doesn’t actually know what you’re thinking. He can only offer temptations and enticements. But if you choose to follow them, he gains greater power over you and the temptations get stronger. By the same token, if you resist evil and choose good, you will be strengthened and blessed.