Firstly, I'd like to commend you for being able to come forward and admit to this. I personally don't believe that you've 'failed' at all at being a Christian, for the Bible has told us that we ARE imperfect. (Rom 3:23) All of us fall short. It is unfortunately, only natural.
Secondly, I'd like to applaud you for trying over and over again to stop. I know the feeling of thinking that it's hopeless, but then giving it another shot. Maybe not in this situation, but hey, feelings are similar.
Thirdly, I'd like to address the issue of you thinking that Jesus answering your prayer. Prayer is a powerful tool in any persons spiritual arsenal. It provides a direct line for you to God to voice your joys, grievances and questions even. Matt 6:8 reminds us that God knows what we need, even before we ask him. However, it is also important to remember James 1:13, that God NEVER tries us with evil things. Rather, 1 Corinthians 10:13 even informs us that God will always give us a way out of temptation.
Now, you might ask, HOW is this? Since you have so sincerely and honestly prayed for assistance. It is all summed up in one word. FAITH. I'm certainly NOT saying that you do not have faith, goodness forbid! Let us first see what Faith in the bible means. I encourage you to open your own bible and read this scripture for yourself from your own translation.
Hebrews 11:1 - Faith, is the assured expectation of things hoped for, the evident demonstrations for realities though not beheld.
If I might ask, when you approach God in prayer, do you already believe, for a certainty, that He will answer you? (Heb 11:6)
Your next question might be, how then, can you develop faith like this? Romans 10:17 answers this. Faith follows the things heard. And the thing heard is through the Word. The Bible. That's is your spiritual answer. Earnest study of it is important. However, whats the point of studying when you cannot understand? So you need to be able to understand it. Furthermore, knowledge itself is useless when you are unable to apply it in life. Hence, you need to meditate upon this knowledge and apply it in your life. Here's another direction your prayers can take. Ask God for help to be able to understand His Word.
Ok. That's the spiritual aspect of your question. I'll go on to a practical approach now.
Going back to James 1, this time verse 15, it tells us that the desire, when FERTILE, gives birth to sin. So when you think of the word fertile, most people (me mainly =b) think of soil and growing plants. What are the necessary conditions? Good soil, ample water, lots of sun. These are all CONDITIONS for the plant to flourish and grow. Do you put yourself in conditions that encourage you to masturbate?
Example: Your internet security. Have you tried using a Family firewall? This will disallow any access to 'questionable' sites. Lessening your access to 'material'. Do you have any books or magazines that might cause such desires? Surely you'll be better off without them. What about videos?
Mayhap it is just your testosterone/estrogen level (Sorry, can't tell if you're male or female). There are medications that can help with that. Otherwise, really, EXERCISE can help! Exercise and sex releases the same chemicals in the brain, mainly, endorphins. This chemical, in addition to others like serotonin and dopamine, gives you a feeling of calm, peace and joy.
Maybe you've tried all these before, especially the paragraph before (getting rid of materials). Have you tried talking to a mature Christian friend about it? I know that this, especially this, is very very difficult. But, God made us to have companionship, and indeed, Provervbs 17:17 reminds us that: "A true companion is loving all the time, and is a brother that is born for when there is distress." Surround yourself with friends with similar goals as yourself, that is to improve yourself by standards from the Bible.
I do not know what else to say other than this, NEVER give up trying to live your life by God's standards. For when you truly give up, then Satan truly wins.
I sincerly hope you are able to overcome this.