I can relate! I sometimes will gain and lose the same 5 lbs. for months, going from elated for losing lbs. to depressed for gaining them back.
Some things that help me get back on track when I have really can't get it together, again, it's hit or miss, but eventually, something clicks.:
Make a wish board. If you don't know what this is, it's a poster board or something similar, and you cut pics out of magazines of what you want in life. The last one I made had plates of healthy food, because my wish was that these would be the foods that would nourish me in the right way. I also had pics of people hiking, and some nice red high heels, lol. Google "Oprah, life map" and you will find a how-to.
I feel just the act of doing this will inspire you. It reminds you, in a visual way of what your goals are.
5 Minute Writing Exercise. The point of this exercise is to tap into your innermost feelings, motivations, sabotages, that you may not be aware of. You start writing out your problem such as "I can't stay motivated to continue on my weight loss path because . . ." and you write, whatever comes to mind. The most important point of this exercise is to not stop writing for 5 minutes, don't let the pen leave the paper, don't stop. Even if you have nothing to write about, write "I don't know what to write, can't think of what to write." You may end up being surprised by what you really do feel inside, and also, how you may be holding yourself back.
I agree with Lovely, about planning things out. I do it myself sometimes. I bought a sketch book and use different colored markers and pencils, and plan out what I will eat for the week. I don't always follow it exactly, but I do much better when I have a plan.
Hang in there!