Try this: Read a prayer to God (you can ask God to get rid of sexual temptation). Try to discipline your mind so you stop thinking about these temptations. If this does not work, talk to a priest or someone at your church. If you are in a relationship, stay faithful.
Hope it's help