Controlling one's sexual thoughts How does one control one's thoughts? ESPECIALLY the uncontrollable desires related to sexual drive which are built deep into our conscience. Answers are DEEPLY appreciated.
Part 1


The nature of the mind is to produce thoughts. Your question about controlling thoughts seems to imply an act of force. 


  Very well then, my friend, I will give you an analogy; for there are
  cases where it is through the use of an analogy that intelligent
  people can understand the meaning of what is being said.
  
  — MN 24


It is similar to asking how does one make a cobra non-poisonous? Sure, one can remove its fangs temporarily until they grow back, but then is it still a real Cobra? If we forget to remove the fangs as and when they grow back, the Cobra will suddenly become dangerous when we least expect it to be, and it will remember the cruelty we inflicted upon it and will have cause to bite.

Taking drugs, or alcohol, or indulging in pleasures and entertainment or even staying busy with a career and family often allows people to temporarily ignore their thoughts, but it always ends in getting bitten by the thoughts when they least expect it, and thus misery endures.

Far better to learn how to not get bitten by the Cobra.

The Buddhist path to not getting bitten by the Cobra is divided into prajna (wisdom), sila (ethics), and samadhi (concentration). It has eight parts, which are also called the Noble eightfold path.


Know that the Cobra always remains poisonous, and how it gets its poison


i.e. understand reality as it is, and whence it gets its fangs from (wisdom)

Don't give the Cobra reason to bite


i.e. don't commit acts that produce poisonous thoughts (ethics)

Learn to leave the Cobra alone


i.e. practice meditation and mindfulness. (concentration)





Part 2


Buddhism or meditation is not a pill one takes and immediately becomes free of thoughts. Learning to not get bitten by thoughts also takes lots of time and patient and wise effort.

The lotus cannot flower without the mud, so it certainly does not help the lotus if it hates the mud. Don't hate the mind that produces sexual thoughts, or develop aversion towards yourself for having them. Nirvana is not obtained by hating Samsara. 

Instead, learn that this is natural, but you can slowly learn to handle it. Develop a desire for Nirvana, and practice with a teacher.

Monks often battle sexual thoughts after decades of being celibate, and this isn't because they are ignorant or stupid. It is a tough challenge, but one worth pursuing and succeeding at.

A lot depends on why you want to control those thoughts, and your time line to achieve it in. Some people decide that it's too much to attempt at one go, and remain lay Buddhists who don't take vows of celibacy.

Sexual thoughts that result in a breaking of the precepts on sexual misconduct are more dangerous, and can be treated more easily.

Seeing the suffering of the person who is the victim of the misconduct and developing compassion for them is a very effective way to control this. 

For example, if one is cheating on one's spouse, reading an internet forum where partners who get cheated on express their suicidal emotions, can for example be very sobering and shake one up to resolve to never do it.

Watching a hard hitting documentary on sex workers, and their conditions, and listening to them speak of their psychological issues, again often leading them to commit suicide can make one resolve never to visit one, and so on.

I recall a Dharma talk by Ajahn Chah who uses the same Cobra analogy.