How does one get rid of lewd thoughts that distract him from his divine service and his purpose in life?
They tell a story of a Ba'al Teshuvah who once came to one of the Chassidic Masters with this question. Having done Teshuvah for his past evil ways, he found that he was still plagued by bad thoughts and fantasies. The Rebbe gave him a parable.
There was once a Jew named Moshkeh who owned an inn where he used to sell wine and spirits to the gentile peasants of the area. After a while, he became disgusted in dealing with the drunken gentiles and decided to go into another line of business and so he closed down the bar. That evening, there was a banging on the door. "Moshkeh, Moshkeh, open up! We want some wine and spirits!". "Sorry", Moshkeh replied, "from now on, the inn is closed". The gentiles had no choice but to leave disappointed. For days and even weeks afterwards, Moshkeh would keep getting knocks on the door, but as the word slowly spread that the Bar was closed, the knocking became less and less frequent until the gentiles stopped coming altogether.
The same goes with these thoughts, the Rebbe explained. After doing Teshuvah, the thoughts keep trying to get in. But if you keep telling them that the store is closed, they will stop coming altogether after a while.