2 Corinthians 10:5 - "Casting down arguments, and every high thing that exalts itself against the knowledge of God, and bringing into captivity every thought to the obedience of Christ;"
Have you ever felt condemned because of the bad thoughts you have had? You may have felt that you had to confess every one of them and seek God's forgiveness. But that is not what God's Word exhorts us to do. God wants us to bring "every thought into captivity to the obedience of Christ." Whose obedience are we to focus on? Christ's obedience and not our own obedience!
This means that when our thoughts condemn us, we are to focus our thoughts on Jesus' obedience at the cross. The devil can only make inroads into our minds when he gets us to focus our obedience instead of Christ's obedience. His strategy is to point us to our obedience or the lack of it to determine our standing before God.
But just as our position as sinners is not based on what we do, but what the first Adam did, in the same way, we are forever righteous today not because of what we do, but because of what Christ, the last Adam, did on the cross. (Romans 5:19)
Affirm the following when your thoughts seem to condemn you:
"My righteousness has nothing to do with my obedience. Jesus' obedience at the cross made me righteous."
Then go ahead and pray, knowing that you have access to God and His favor, and the He hears the prayer of the righteous. (Proverbs 15:29)