QuestionHow can I get rid of filthy thoughts? I am always encountering sexual thoughts when I am praying or trying to study. I have not masturbated in a month now, and during this month I had two wet dreams in the night with sexual thoughts in the dream, like I am having sex with someone.
AnswerLet's back up a bit to address the problem of filthy thoughts. First off, God designed our bodies with basic desires. These desires have purpose. The desire to eat (hunger) and to drink (thirst) reminds us to fuel our bodies. The desire for sex is to spur us to get married and have children. There are also more subtle desires, such as the desire to be liked and wanted. None of these desires in and of themselves are wrong.
James 1:13-16 tells us that Satan makes use of those basic desires, putting us in situations where it seems as if the only way to fulfill those desires is to break a law of God. The situation is temptation. When we given in to the temptation and accept that we want to do what is being offered strongly enough that we are willing to risk breaking God's law, then we move into the realm of lust. When the opportunity arises and we actually do it, it becomes sin. When we sin often enough that we no longer care what anyone else thinks of us, then we have gone into licentiousness. Finally, all that remains for us is spiritual death.
Now, let's talk a moment about physiology. The male body has two seminal vesicles just below your bladder. These two glands constantly produce semen (the sugary fluid that feeds your sperm and provides the bulk of what you ejaculate). The speed in which these glands produce semen is dependent on how often and how strongly you get aroused.
As the seminal vesicles fill, chemical signals go through your body gradually raising your desire for sex. The best way to describe it is to compare it to your bladder. As it gets full, you become more and more aware that you need to get to the restroom. You can put it off, but eventually you are "dancing" trying to keep it in. When you finally do empty your bladder, there is a feeling of great relief. The seminal vesicles work in a similar way, but the signal it produces is that of a desire for sex. As it fills we get more sensitive to potential sexual situations -- to the point of distraction.
Wet dreams are one way the body gets rid of the excess semen. When the levels get too high, you essentially masturbate in your sleep or semi-sleep state. You really don't have control over this because it is a natural male function. Dreams accompany the masturbation because thoughts are a part of sexual arousal. The brain pulls up things which it has filed under "sexual" though often the oddest combinations come up because of the way the brain is wired. The dreams may even be about things we know are wrong. But what you have to remember is that they are just dreams. You don't have control over your dreams. A lot of young men panic over what they dream about and wonder if the dream means they really are that way deep inside. I know. I remember those doubts when I was younger. The short answer is that no, they don't describe who you are any more than seeing a movie that has a disgusting scene it means you are also disgusting.
You can't do anything about wet dreams because that is how God made you. The only way you can "fix" what you dream about is to give your brain less material to work with. Filling your head with pornography and other sexual concepts will just come back to haunt you in your dreams as your brain dredges up images to use for the wet dreams. In computer programming, we used to say, "garbage in, garbage out."
Nor can you totally get rid of filthy thoughts during the day. To do so would mean that we can stop Satan from tempting us, and that isn't going to happen. Satan can't tempt us with sex if the thoughts don't pass through our heads. So we must expect that passing inappropriate thoughts are going to come.
Where we can and should do battle is our response to the thoughts. We can reject them and tell ourselves that they are not a part of what we want in our lives. So when you wake up from a vivid wet dream, it is perfectly correct to think, "Eww! I'd never do that!" When a sexual thought interferes with your studying, get up and take a walk or do something different to distract yourself and then go back to studying. And realize that as your seminal vesicles fill, that sexual thoughts are going to intrude more often and that shortly you will be having a wet dream again. It is a part of life as a male.