Don't give up. Most failures are the result of people who quit because they don't realize how close they are to succeeding (paraphrase of a quote I read somewhere.) This particularly has applied to me in the realm of quitting smoking. I can't even remember how many times I have quit smoking "for good" but after each time I went back to it, I persistently quit again. I guess it is the same as the japanese saying "fall seven times, get back up eight"
The benefits of this are you know you have done your best, no matter what. When you reach a goal you can look back and be proud of your strength and work you put into it, and use that experience to help you get through other challenges.