I share that pain too. For the last 6 months or so I've been working on an engine for a cinematic platformer (which started out as a learning project for construct 2) and recently I discovered that the thing I've been building upon, iterating and molding just doesn't work when it comes to making something worthwhile; it was just too damn buggy and unreliable haha.
So I'm currently rewriting the engine, with all new knowledge and understanding of the engine that I've gathered over the past 6 months of development. And so far it's almost bug free - because I built the engine on the same basic idea as the old one, so fixing any shortcomings was a piece of cake for this one, I'm also writing the new engine so that it's easier to implement new features because it's structured in a much more intuitive way: grouping, functions, compress the amount of variables as much as possible etc.
And also, agreed with TiAm, those three points: can't stress it enough, I have post-it's everywhere with reminders to "keep things simple" and the like, it's surprisingly easy to fall into old, bad habits. And also: comment early, comment good. Make sure that your code is readable after returning from vacation or long breaks. It's much more fun to work on a project when you don't go "*sigh*.. Aalright, let's take a look" whenever you want to implement some new feature and such.
Those are the things that I'd say works for me. Often, the hard part for me is not that the passion for the project has died off but that all of the seemingly miniscule problems (like unorganized pieces of code, uncommented code etc) pile up into an unmanagable behemoth that's just too much to care about. So yeah: "organization, organization, simple, simple".