Just as a security guard will deter a thief from robbing a store, the awareness that you are in G-d's presence will empower you with the ability to control your eyes. Without Yirat Shamayim, genuine awareness of Hashem, it is impossible to overcome desire.
King Solomon explained that Yirat Shamayim is the sole antidote for our yetzer hara(Kohellet 11:9). We define Yirat Shamayim as the awareness that:
(1) Hashem sees our actions and knows our thoughts.
(2) Hashem judges all of our deeds and metes out the consequences.
The spiritual reward and punishment that the soul experiences in the World to Come is infinitely greater than the physical pleasure and pain of this world.