Like almost every other aspect of being a man, this is about discipline. In this case, disciplining your mind. I'm single so I don't know what struggles married guys face but I don't imagine its all that different.

First, you have to make the conscious choice that you are not going to entertain sexual thoughts. Acknowledge what the word says about sexual immorality and specifically lustful thoughts (Math 5:27-28, 1 Cor 6:9) There is no compromise to be made here. Compromise always leads to sin.

Second, the bible tells us to literally flee from sexual immorality. I can't emphasize enough how important this is. This means physically removing yourself from situations, websites, advertisements, etc. that you know might trigger these thoughts.

So at this point you have acknowledged that these thoughts are sin, you've establish that you refuse to dwell on them, and you have physically removed yourself from any stimuli. But how do you flee from your own brain?

Its easy to feel trapped at this point; unwanted thoughts spring to mind, and you have to constantly squash them. What has worked for me is a series of mental exercises for clearing your mind.

The first, and probably most powerful, is to simply try as hard as you can to think about absolutely NOTHING. When you first start, its basically impossible, you simply can't do it. Don't be discouraged though! Its called an exercise for a reason. As you do it more often, you get better at it. Eventually you can stop and think about nothing almost immediately. On the bus, in your office, at the gym. Once you have cleared your mind its your choice what to put in that blank space. Some people say to focus on your breathing, but I like to focus on a verse I am memorizing at the time. Its the most literal definition of 'meditate on scripture'.

Obviously though its not easy to clear your mind, and thoughts can come like a barrage of images, sounds, etc. People who get really into meditation will develop their own set of techniques to 'destroy' those thoughts. A technique that works well for me to combat this is to imagine the image in your mind being sliced to pieces with a sword like a piece of paper in a shredder. Some people imagine a flame or an explosion. They all serve the same purpose though, this makes your mind 'cycle' to something else and remove the visual aspect of the thought which for men is often stronger than the 'emotional' aspect of it.

Another technique that works well is basically tricking your brain into staying in that space between thoughts by rapidly cycling through ideas, not resting on them for even a fraction of a second. There is a very tiny delay between when one idea enters and another leaves your brain, and during this time you're not thinking about anything. The easiest way to experience this is to move your eyes around rapidly, focusing on what you're looking at but not pausing long enough to really take in what you're seeing. Notice how you're not really thinking about anything? Its like you've overloaded the ram in your brain and its dumping memory trying to process everything.

Working at these techniques has allowed me to put an absolute stop to entertaining any kind of sexual fantasy or sexual thoughts about women and has given me dominance over my own brain. Obviously its still a battle, but now its a battle I am winning decisively.

No, it won't make you any less horny, but it will allow you to control how you respond to those urges. This turned out longer than I was expecting, but to be honest I get so frustrated with the amount of advice thats thrown around that includes no specific, actionable points or examples. I hope I provided some that you guys find beneficial.