The Gemoroh (Berochos 5a) says, that a person (who is suddenly attacked by the menuval) should get angry at the menuval, yell at him and put him in his place.
If that doesn't do the job, he should learn Torah. [Under "normal" conditions Torah is a very very powerful weapon against the menuval.]
If that doesn't do the job, he should read "Krias Shema" [IE: He should think about his purpose in life, Hashem's love for us, reward and punishment etc. And he should awaken his love for Hashem]
If that doesn't do the job, he should think about death.
R' Tzadok Hacohen explains, that what will work, depends on how much the menuval has already gotten control over the person. The last step [as opposed to the previous ones] is not a mitzvah, [we are supposed to think positively and be oved Hashem with simcha] but once the menuval has become the "baal habayis" -boss, drastic measures are necessary. R' Tzadok also says, that you need to do all the steps in order for the last one to work.