I have a specialty on sexuality and sexual addiction and your question is a common one that demands a clear but Biblically sound answer. Abstinence and celibacy are two ways to reduce sexual temptations, but according to the apostle Paul, this is not a gift many people have. And based on my study of the scripture, the original design of mankind is for marriage and bear children. This completes God's intended design for people. Curiously, this is how we get to know God more by being married and having children.
Some practical ways for purity resides in the management of ideations. Please see the last presentation outline (bottom of the page at: <http://www.christianmentalhealth.com/workshop.htm> What is obvious also is in the management of "triggers" that give rise to "ideations." There are two factors involved. One is the "push" factor and the other is the "pull" factor. "Push" means the internal drive that we derive from within out psyche because we are "starved" for meaningful relationship and due to the intense thirst for this that we "sexualize" it. The "pull" factor is easier to manage because it deals with external photos or images of sexual beings whether it is man or woman portrayed in a sexually seductive positions. This is easier because we can avoid them if we are careful enough. Such as no pornography or in the U.S. not watching movies with an "R" or "X" rating. To deal with the "pull" factors is easier and it is passive in nature and it is symptom removal.
The key for success really relies in the management of the push factors within ourselves. There are several ways to do so. One is have an accountability partner that we talk to right at the moment when we are tempted, and we have to tell the truth. An additional step is to learn to express yourself in a deep and intimate manner with someone of the same-sex but absence sexuality. We need to learn to be vulnerable. If this is achieved, the temptations will not control us rather it is the other way around. Of course, in the practice of these management techniques, fellowship with God and with people at church is a must. For those who cannot reach success by himself, he should consider personal counseling with an experienced counselor. Or, to attend a support group such as "Sexaholics Anonymous" Please see my website for ways to contact one.