Welcome.
This is a Forum mainly for Jewish people so myself and I guess others will not be referring to your religious beliefs because they are not all the same as our's.
But in wishing to keep personal holiness I commend you and I think a key thing is to realise the HALT method.
Hungry
Angry (resentful of something not going your way)
Lonely
Tired
These four circumstances can be triggers.
If you are single, then being in a loving relationship which becomes marriage is the appropriate path.
This will not cure things, but it is healthier than being single.
There are filters one can install for computers to avoid porn sights....others here can help with that.