Cry out to Hashem
Sometimes a person may be taking a walk or laying in bed and lustful thoughts start to fill his head and it seems like he can't control it. At such a time, don't try to stop the thoughts - they may just become even stronger. Instead, cry out to Hashem and say "Please Hashem, save me from lust, which is filling my head and heart! Please rid me of these thoughts and desires, for they are tormenting me! I want to love you instead, Hashem--"Kama lecha nafshi, tzama lecha besari" - My flesh pines for you, my soul thirst for you, Oh Lord."
You will be amazed at how powerful prayer is. Put your trust in G-d and you will suddenly feel a relief from these thoughts.