One moment at a time.
Rebbe Meir of Permishlan once gave the following mashal:
"There was once a farmer who was addicted to his alcohol. One day he decided to stop drinking! Every so often he would have a tremendous desire for just one drink, but he controlled himself and did not give in. Once, he just could resist and started heading to the bar. He was already on his way when he thought to himself, 'What am I doing? I will drink and then roll drunk in the gutter?! No way!' He turned to go home. As he enter his yard he was ecstatic. What a hero and warrior he was! "You know what?" he proudly said to himself, "such a warrior is worthy of a good drink!" Off he went to the bar.
The yetzer hara has to constantly be held down, concluded Reb Meir.
If it is unmonitored for even a moment, it finds a way to come back.