It's amazing that the Buddha knew there was more out there. He'd tasted the heights of pleasure (for a heterosexual) by living in a house where there were only women and they were there to please him. He left his family and home to search. He went to 2 teachers who could do amazing meditations. But still they were not enough. He spent years in ascetic practices--fasting, bearing the elements (heat, cold, wet), physical discomfort, controlling his breathing.
The idea of transcending desires, Nirvana, was his goal. To go beyond illness, old age and death. His mind control was so good he was not even overwhelmed by the painful feelings of his asceticism.
Any temporary victory did not lead to not having a struggle again and again.
It is just like meditation. We can only not take up the unwholesome ideas. It is a gradual method, repeated again and again. Here are the strategies for addressing unwholesome thoughts (from Analayo):
-turn to something wholesome.
-think of the dangers of giving into such an unwholesome thought.
-set aside the issue at hand.
-gradually relax the motivational force behind thought.
-forceful suppression (You don't use an emergency brake all the time, you use it sparingly in extreme cases).