There's a really good sermon somewhere online about this. To keep it short, sex should be the final stage of love. Sex should be like a gold medal at the top, and you should work hard at it. To have sex is like training for months to win first place in a race.
Masturbating is like a participation trophy. You can feel good, but anyone can do it and it's truthfully worthless.
When you can commit yourself to share your passion and intimacy only with your wife, then you are getting the full reward for your commitment.
Sex is not just about sex. It's about trust. When you have sex, you get kids. If you cannot maintain a strong trust between yourself and your girlfriend, you will not be able to retain the strong trust required to raise a child.
Remember that when you masturbate or have sex outside of marriage, you are tearing down the foundations of your love. Without trust, there can be no relationship.
Ultimately, I think if you decided to humble yourself and truthfully ask Jesus to be your savior (if you haven't already), and then pray for help, I think God would be willing to help you on this topic.
Peace be with you.