Speaking from my personal experience (which is my only qualification to speak at all), keeping a steady stream of new and different jobs does the trick. I've been programming professionally for thirty-five years. I've never had a gig that lasted more than three. Some are "permanent", some contracts, some on-site, some remote. Many of them have great promise at the start ("I could retire with this job"), but something always changes. The project is finished, or cancelled, the company goes broke, or sees a major shift in direction, management changes and has different priorities than before. Some times it just doesn't work out.
But the end result is that I'm in no danger of becoming complacent. There's always new stuff to learn, new projects to pursue. I'm still having fun.