Because of original sin, we have lost full control of our procreative faculty, and now have to really work at remaining chaste. This is even more challenging, as you rightly mention, in our sex-saturated culture where so many things are being sold through some form of sexual seduction. This is a battle against the flesh, the world, and the devil, and a battle that must be fought with God's grace.
Let's begin with the truth about sin. Both masturbation and fornication (premarital sex) are considered as grave matter. These acts seriously violate human nature and marriage, and one should do whatever is reasonable to avoid these sins. The common practice of these sins today do not make them any less grave.
Secondly, frequenting the sacraments of Confession and Eucharist is irreplaceable. We cannot win the battle without our proper ammunition. If you have gravely sinned, do not receive Communion before going to Confession. Cleanse yourself first of any guilt you may have in Confession and persistently receive this grace Jesus offers you there. Take your Sunday Mass obligation very seriously, and receive Jesus in Communion whenever possible.
That's the ammunition; here's the strategy. One suggestion I have is to consciously discipline your eyes and mind (including your imagination) every moment of the day. This means when encountering women in real life and in media images, make an effort to look only at their faces. Don't allow your eyes to roam. And when you glance at their faces, see them as persons — someone's daughter, sister, future wife, and future mother; someone with feelings and aspirations, a child of God who God loves. See her as someone who needs love, not to be used as an object, even if, in her confusion, she seems to offer herself to be used. Never take advantage of a woman's confusion — in real life or through their images. Try to see each woman through God's eyes.
As for the imagination, don't allow it to fantasize about sex. When you notice it going in that direction:
- change the subject
- sing a song
- do a math problem
- turn your attention to something in the room
- do a task that needs doing, and
- pray for perseverance in chastity.
Prayer should be consistent. Once you become more in control of your eyes, mind, and heart, you will experience more freedom.
One last thought. This is counter cultural, like all the other advice. I do not know your age, but do not be afraid of early marriage. I know contemporary culture militates against marriage, but we cannot forget the traditional wisdom of the Church that marriage is a remedy for concupiscence.
Late marriage tends to perpetuate sexual sin and lead people to rationalize their sin by calling evil, good. Never fall into that trap. God would never call us to chastity without giving us the grace to conquer our disordered desires.