Usual figure quoted is 500 million years for it to remain habitable. Or could be a billion. But it continues as a planet, after is oceans boil and eventually it loses its atmosphere, for several billion years after that.
To put this into perspective, it took 500 million years to evolve from the first complex modern multicellular tiny micro-organisms through many strange experimental seeming creatures, tiny worms, fish, amphibians, dinosaurs, mammals, eventually thus. All that could happen a second time before the end of the expected habitable time of the Earth, so creatures that are only a few cells in size now could evolve to the likes of humans by then, easily.
This assumes nobody does anything about it. By then, hundreds, or thousands more likely of species and technological civilizations may have arisen and fallen on Earth. They may have ways of shifting Earth that we haven't thought of. But it is already possible with the technology we have today, if you can manage to sustain a long term project for so long, for hundreds of millions of years. Basically, you set an asteroid to do many repeated flybys of Jupiter and Earth. Just one very large asteroid would do. This can be timed to transfer momentum to Earth from Jupiter by the positioning of the flybys.
You'd need to have technology that continually applies small nudges to your asteroid, reliable for hundreds of millions of years, does very close flybys of Earth but never hits it. It's way beyond us, just because we can't guarantee to be able to keep a technology project going for half a billion years, and if it fails, the risk would be huge for Earth.
But there may be safer and easier methods than that. For instance Let's Lift The Earth!