For several years I struggled with masturbation and lust. Many of which were accompanied with pornography, but I have gotten a grasp on my self-control and haven't had a problem with pornography in the past year or so. However, I feel so ashamed about all of it.
Several months ago I got in a relationship with a girl that is very close to me. For years I had wanted to quit masturbation with the lustful thoughts. I have read several of your answers, and I realize that the Bible doesn't condemn the act of masturbation, but that the lust is the real sin. When I started my relationship, I promised God and myself that I would quit, and I prayed and prayed that He would help give me strength to quit.
About two months into the relationship I decided to tell her about my past. She asked me to tell her something she didn't know about me, and I didn't want to be hiding any secrets from her. She was the first person I ever told. She is a Christian, and at first she didn't handle it well, but then everything was all right. She made me promise that I would never do that again, and so I promised her.
Everything had been going so well, and I felt myself growing nearer to Christ. Then she broke up with me a little over a week ago, and I was left completely heartbroken and devastated. We have remained close friends, and she is still my best friend. We have talked that maybe we will try a relationship again. She broke up with me a week before spring break, so that's where I am now. We took a vacation to Florida. There are girls in revealing swimsuits everywhere, and about midway through the week, lust got the better of me. I masturbated with lustful thoughts again. I know that judgement centers of the brain don't function properly when aroused, and at first I told myself that what I was doing was okay. I also told myself that as long as I didn't ejaculate, it wasn't really masturbating. My thoughts were clouded. What happened was I stroked myself several times so I had an erection, and then I gripped my penis held it under the shower water until it stimulated me to the point of orgasm. I can't lie to myself though. I had lustful thoughts in mind and I know what my intentions were.
I feel so guilty. I had been doing so well and I feel that I have ruined all the effort I have put in to not doing it. I feel so ashamed for breaking a promise I made to God. I know He is loving. I know He is forgiving. But I still feel very ashamed. I also feel guilty for breaking the promise to my friend. I really care for this girl, but I broke my word to her. Right after I succumbed to lust, I immediately felt a surge of guilt. I felt like I wanted to bang my head against the wall of the shower (I controlled myself enough not to). I was so angry with myself. I wanted to throw up. I know that nobody to walk the earth except for Jesus Christ himself has or will ever be perfect. I know that even though I try, I can't live a life completely void of sin, but I'm still struggling with knowing what I have done. I feel like I lost control over something I had conquered. I love the Lord, and I want to spend eternity with him in heaven. I have asked for forgiveness, but I still feel ashamed for breaking my promise to He who gives me everything.
I take it that you stopped masturbating completely and for months you managed a steady state where wet dreams took care of your needs. However, you found yourself in an overstimulating situation and found you needed to masturbate, but you weren't able to keep your mind off of lustful ideas while doing it.
Just so we are clear, lust isn't the desire for sex. It is the thoughts of having sex when you are not married, to the point that you are thinking of reasons why it would be justified to do it.
Sins, like lust, do creep into people's lives. It isn't an excuse, just a reality. "If we say that we have no sin, we deceive ourselves, and the truth is not in us" (I John 1:8). You had a setback, but you are not defeated. Analyze why you went wrong and work to make corrections in the future. For example, when you realized you were lusting, you could work on forcing yourself to think about something else while finishing. Or you could stop and take care of the need later.
Jesus warned against making promises. "But I say to you, do not swear at all: neither by heaven, for it is God's throne; nor by the earth, for it is His footstool; nor by Jerusalem, for it is the city of the great King. Nor shall you swear by your head, because you cannot make one hair white or black. But let your 'Yes' be 'Yes,' and your 'No,' 'No.' For whatever is more than these is from the evil one" (Matthew 5:34-37). Making a promise to God not to sin is foolish. First because God has already commanded you not to sin. Your promise to do what you are already commanded holds no real meaning, else you are saying you are only keeping the commands that you agree with. Second, since God said sins will happen to everyone, you are promising that you are stronger than God said you are.
It is fine to agree to stay away from pornography, you need to stay away from it anyway. You do have to battle lust as well. But neither of these require promises. Promising not to masturbate is limiting your options when there was no real need to do so.
Therefore, apologize to God for making foolish promises. Go back to what you had been doing. And if you happen to find your sexual desire getting out of hand once in a while, you know you can relieve yourself -- though you will have to work at keeping your thoughts off of sin.