To answer this question, let's first ignore the possibility (quite strong actually) of humans killing themselves off due to nuclear war, climate change, etc. Let's focus on natural changes to Earth only. If we make this BIG assumption, this question boils down to the lifetime of the Sun and changes to the Sun over its lifetime.
The Sun is a star with enough "fuel" to survive 9-10 billion years before reaching the final stages of its life (white dwarf). The Sun is about halfway through its lifetime, meaning that it has another 4.5-5 billion years before it expands into a red giant before becoming a white dwarf. When the Sun becomes a red giant, it will grow in size, swallowing up Mercury, Venus, and possibly Earth. Earth is toast, literally, at this point. At first glance it may seem that Earth has another 4.5-5 billion years of habitability. Not true.
Over longer periods of time, the Sun is slowly increasing in brightness. This results in temperatures at Earth's distance increasing. This is NOT the cause of global warming on Earth. Global warming on Earth is happening WAY too fast to link it to the Sun. Global warming on Earth is caused by humans. The science is VERY clear on this. Back to the Sun. In about 500 million to 1 billion years, the temperature at Earth's distance will increase enough that Earth will no longer be in the habitable zone. That's still a very long time, but not nearly as long as one might think based on the Sun's remaining lifetime.
If humans don't kill themselves off first, I have to think we'll have the technology to move elsewhere in the Solar System or Milky Way galaxy to avoid the fate of dying on an inhabitable Earth. Or we'll have built a dome around the Earth to keep us sufficiently cooled. Who knows? A half billion years is a LONG time!!!