A couple of other things Ray said:
Sometimes it was a long time after he wanted to be free of a sin before he was not under its dominion.
The reward for repentance is a clear concience.
Whatsoever things are ...pure...think on these things.
There are no magic bullets.
If I'm going to do better than before, I want to seperate porn from masturbation, even though the two are often intertwined.
What's helped me with porn (and the lust of the eyes):
Love. When you see the object, you're seeing a person who is a fellow human being. It doesn't matter if she is willing, or blatantly seductive, or whatever. It doesn't matter that if you 'preached' the gospel to her in your heart, she might bite your hand and resist forgiveness. She's also somebody for whom the Lord died and somebody destined to be in the Family of God. If your heart can change to see her that way, you will grow to not want to see her any other way.
Does that work? Love never fails. It's not just something we need and want to experience from God, but something we need and will want to give to others, including that model or actor or whatever. I fail to love, but when I love, it never fails.
There are a lot of ways to 'flee youthful lusts', but all of them require us to 'flee'.
As for masturbation. That's trickier because sometimes we think of that as a need. Sometimes, but not always. Sometimes its just bordeom, or self-soothing, or force of habit or some other motivation. Bordeom can be cured. We can break habits, avoid temptations and 'inflammations' (like porn), deny ourselves, etc. I'm not saying its easy...no change is. But it is a way of escape that's given to us when we're ready to use it.
Scripturally? I can't do better than John did.
Spiritually? Resist the Devil. I don't believe the devil is very much involved in the 'temptation'. That's something most guys need precious little 'pushing' to do. Resist the Devil trying to lie you under condemnation. Resist him lying that there is no salvation. Resist all his lies.
Psa 37:23,24 The steps of a good man are ordered by the LORD: and he delighteth in his way. Though he fall, he shall not be utterly cast down: for the LORD upholdeth him with his hand.
Pro 24:15,16 Do not wait in ambush as a wicked man against the homestead of a righteous man; Do not devastate his reclining place; For the righteous one shall fall seven times and still rise, Yet the wicked shall be stumbled by evil.
Meditate on that for a good while. There's real, heavy, fatty red meat on that. (to note: If we can have sex with ourselves, can't we "wait in ambush" against ourselves? I think so.)
1Jn 1:6 If we should be saying that we are having fellowship with Him and should be walking in darkness, we are lying and are not doing the truth."
1Jn 1:7 Yet if we should be walking in the light as He is in the light, we are having fellowship with one another, and the blood of Jesus, His Son, is cleansing us from every sin."
1Jn 1:8 If we should be saying that we have no sin we are deceiving ourselves, and the truth is not in us."
1Jn 1:9 If we should be avowing our sins, He is faithful and just that He may be pardoning us our sins and should be cleansing us from all injustice."
1Jn 1:10 If we should be saying that we have not sinned, we are making Him a liar, and His word is not in us."
What is that darkness in vs 6? I think it's the same darkness that the self-righteous Pharisees had when The Lord warned that if the light they had was darkness, how dark is the darkness. The 'cure' is walking in the light as expressed in the remaining verses. Absolute, bone-crushing, heart revealing honesty every step of the way. Does that work? It's the only thing that has ever worked for me.
Do good.