I feel for you. This was me for so so long.
First, it's normal to go cold on a book, then hot again, then cold. A lot of that is fatigue. If you haven't taken a longish break from it, do it, write a first draft of the next thing, then go back to the first book with fresh eyes.
I stayed motivated by thinking of the characters and how much I loved them. I also reminded myself to have fun. As much blood as I was leaving on the keyboard, I still loved what I was doing, the discoveries I was making every time I revised. The book was getting better and that motivated me. It was also motivating to get feedback. If you haven't had a set of eyes on your story, either writers/editors/agents or readers who aren't family or friends, get the book out to someone who can tell you its strengths and weaknesses. That'll give you fresh wind to edit until it truly is done. (BTW, "done" means you don't feel you can improve it anymore at that moment either because you're too cold on it or you feel you don't have the skills to improve it. If you take a break from the book, come back and still feel that way, give it to betas or seek other help and see if it kickstarts you. And always, always study the craft as you write.) Good luck!