How to control sex desire
Krishna explains in the Bhagavad-gita that lust arises from contemplating the objects of the senses. Therefore try to avoid thinking about or seeing the opposite sex as far as possible. And the secret—according to Krishna—is to get a higher taste from spiritual activities.
Practice makes improvement. Try to engage the mind in practical service, as well as hearing and chanting about Krishna. The more we do that, our mind will have less time to contemplate the objects of the senses.
Don't purposely go places or do things that you know will agitate your mind sexually. And don't despair or become depressed; it takes time to train up the lusty mind.
Meditating on the beautiful form of Krishna, beginning with His lotus feet, helps free the mind from lust. It may seem hard to believe, but if you try it, you will see it works.
We also should eat prasadam, vegetarian food that is offered to Krishna. In these ways we can spiritualize our mind by engaging it in Krishna's service.
We shouldn't be impatient. Sex desire is something we've been involved with for many lifetimes. It's not like it will disappear suddenly. But it becomes easier to tolerate as we absorb our mind in a positive spiritual way.
We can read sections from the scripture that describe how entangling sex desire is. These include the Forest of Enjoyment chapter of the Fifth Canto, Lord Kapila's teachings about adverse fruitive activities in the Third Canto, the Aila Gita from the Eleventh Canto, etc. These convince us intellectually of the value of controlling sex desire.
There are also foods that can be avoided: Don't eat too many grains or yogurt at night. Don't eat lots of rich foods like cashew nuts. This causes nocturnal emissions. Don't talk about mundane male/female relationships or associate with people who do.
Bhakti Vikas Swami has a book on Brahmacarya, celibacy. You can find it on his web site.