Invoke Jesus and Mary against evil thoughts
When an evil thought is presented to the mind, we must immediately endeavor to turn our thoughts to God, or to something which is indifferent. But the first rule is, instantly to invoke the names of Jesus and Mary and to continue to invoke them until the temptation ceases. He who trusts in himself is lost. He who trusts in God can do all things.
St. Alphonsus Liguori