I'm in the same situation! I'm starting a PhD in the fall, which I'm so excited about, and currently in my final exams of my MA. It's been particularly hard to motivate myself because overall I'm not happy in my MA dept - just not a good fit for me.
I'm motivating myself in two ways. First, I've created a reward system. If I productively study for X many hours today, or completely Y tasks from my to do list, then I'll treat myself. All little things like yoga, playing guitar, going for a walk, whatever. Second, I'm using this as practice for my PhD. I'm sure there will be a million times during my PhD when I won't feel like working, so using this time to build up my self-discipline will pay off.
Good luck everyone