The best way to overcome temptation is to avoid it and flee from it - as Joseph did ( Gen.39:7-12 ). Avoid all places and people that tempt you strongly and that make you weak. Jesus taught us to pray, "Lead us not into temptation". In eternity you will be thankful that you did that. Even on earth, in a few years from now, you will be thankful that you avoided places and people that could have caused you to be tempted beyond your ability to overcome. Your avoiding such places and people is the way that you prove to the Lord that you are really eager to please Him alone. (Read Proverbs 7 in this connection. That is a good chapter for all young men to read every now and then).
Flee from too close a friendship with the opposite sex. Flee from literature (and websites) that provokes and stimulates your lusts. Flee even from the waste of time that there is in watching useless TV programs. Flee from listening to gossip. Listening to evil, reading evil, and watching evil, will only make you knowledgeable about evil. But why do you need that filthy information? It will only pollute you and destroy you. You must shut your ears and your eyes, from now onwards, to all such information. To know the evil that others do, will never make you wise. The Bible exhorts us to be "like infants, in matters of evil" ( 1 Cor.14:20 ). The mind of a child is pure from all evil. And the good news of the gospel is that even though we have spent so many years polluting our minds with evil information, if we really long to be free from it now, the Holy Spirit can help us to have the pure mind of a child once again. This is what the grace of God can do for us. Praise the Lord! We are called to be "innocent concerning what is evil and wise in what is good" ( Rom.16:19 ). So ask the Holy Spirit to show you how Jesus lived. Then you will know what it is to be "wise in what is good".
If you do fall into sin, you must immediately mourn and seek for pardon; otherwise you will begin to take sin lightly, and then victory will become more and more difficult. So, you must learn to keep short accounts with God, confessing sin, and forsaking it and repenting from it, as soon as you are conscious of having come short of God's standards anywhere. If you mourn each time you fall into any sin, that indicates to God that you are really thirsting for a life of victory over sin. And so, whenever there is the slightest unrest in your conscience about something or the other, settle the matter immediately. Confess the sin to God at once, even if it has been only a failure in your thoughts. Apologize to whomever necessary. And you will then see how God strengthens you mightily.
That is the secret of victory. Keep at it - as a student keeps working at a homework problem until it is solved. The temptation to be discouraged is universal; but don't give up. God made a perfect plan for your life before you were born (Psa.139:16 ). Don't let Satan ruin it. Whatever the cost, take a stand for the Lord. Jesus said in John 14:30 that when the prince of the world came, he could find nothing in Him. We are now called to walk as Jesus walked. When Satan comes to you, he must find nothing in you. This is why you must " always do your best to maintain a conscience that is without offence towards God and towards men "( Acts 24:16 ). You must seek God with all your heart for His help to live without sinning consciously. Yielding to your lusts will give a foothold to Satan in your life. Romans 6:1 asks the question, "Shall we continue in sin?" Then Romans 6:15 asks the question, "Shall we sin even once?" To both questions the answer is a resounding, "No, may it never be." Temptations and mistakes will be a constant part of your life until the end of your life. But you can come to victory over conscious sin, after a while - and then falling will become rare thereafter.