If you are planning to stay celibate the rest of your life the plan would be 1) is it practical for you? Do you have that gift? If not then plan on getting married instead.
If you do have the gift but don't want to be foolish and see how close to the flame you can get before you feel heat then don't expose yourself
unnecessarily , to the flames. Don't watch ungodly entertainment. That will plant seeds in your mind that will grow. It will warp your world view. I don't care if you disagree with me or not, it's a fact.
If you have decided to marry because you know that you do not have that gift the same advice applies. While you are meeting and developing relationships with friends in church that will one day result in finding that one you are interested in marrying you will need to keep your mind pure by how your control your thoughts.
It is not that hard to stay holy and pure when you are experiencing the daily sanctifying power of the Holy Ghost by not yielding to fleshly thoughts and actions. Yielding your mind to the thoughts of the Holy Spirit and to deeds of the Spirit will make you a slave to righteousness, it will be what comes first rather than being such a struggle. The resisting of sexual impurity will become habit, it would take a slow fade to fall.
The solution is to renew your mind with the Word of God. Soon you will find that the transformation of the mind by the Spirit will empower you to control impulses and you will not be overwhelmed with urges that you can't control.
If you speak out loud and pray, and worship the Lord out loud with your mouth in the moment of temptation that also helps. For example. If you find yourself is some sort of battle just begin to worship the Lord and say...
"Thank You Jesus, You have saved me and made me holy in your sight and I thank You.
Thank you for making me the righteousness of God in Christ Jesus.
I so appreciate what you have done for me in cleansing me and making me white as snow.
Though my sins were as scarlet now I am white as snow and I love this Fellowship with you and the Father.
Oh Jesus I do not want anything to come between this precious love we have and this clear conscience you have given me by making me free from sin and lusts."
Just keep that up and you will soon find you have total victory. It really works. It is called Submitting to God, resisting the devil and he will flee from you.
This advice never drove any young person out of church. The only ones who reject it are those who don't do it. Of course it wont work if you don't do it and look for some other answer.
Loving Jesus more than you love sin is the answer for overcoming any temptation. Also remember that there is always a way out, and usually it starts with a simple decision to look for the way out and decide you would rather die than to deliberately grieve God's heart with sin again. When God sees that kind of heart of faith and love he will move heaven and earth to come to your aid and help you in your moment of temptation.
For those who have fallen into sexual sin in the past but have returned to the Lord and do not want to ever fall again, they understand what I am talking about. And that is why I suggest a song like the one below in the moment of temptation. There are other songs they could find but having a good worship song that means something to you and helps you focus on Jesus is a good weapon to have in your arsenal when doing battle against temptations: