Assuming humans as an intelligent species will be able to changes to our planetary environment they could survive into the indefinite future except for one thing. namely, the impact of the increasing luminosity of our Sun as it progresses along the Main Sequence.
Approximately 1.1 billion years from now, the Sun will be 10% brighter than it is today. This increase in luminosity will also mean an increase in heat energy, one which the Earth’s atmosphere will absorb. This will trigger a runaway greenhouse effect that is similar to what turned Venus into the terrible hothouse it is today.
However, it gets better.
In 3.5 billion years, the Sun will be 40% brighter than it is right now, which will cause the oceans to boil, the ice caps to permanently melt, and all water vapor in the atmosphere to be lost to space. Under these conditions, life as we know it will be unable to survive anywhere on the surface, and planet Earth will be fully transformed into another hot, dry world, just like Venus.
Next comes the red giant phase which could represent the final death knock for planet Earth. Provided enterprising humans have developed the technology they could still be sheltering deep underground. There is a question of uncertainty whether the red giant phase will be the final end.
In 5.4 billion years from now, the Sun will enter what is known as the Red Giant phase of its evolution. This will begin once all hydrogen is exhausted in the core and the inert helium ash that has built up there becomes unstable and collapses under its own weight. This will cause the core to heat up and get denser, causing the Sun to grow in size.
Which won't be so good.
It is calculated that the expanding Sun will grow large enough to encompass the orbit’s of Mercury, Venus, and maybe even Earth. Even if the Earth were to survive being consumed, its new proximity to the the intense heat of this red sun would scorch our planet and make it completely impossible for life to survive. However, astronomers have noted that as the Sun expands, the orbit of the planet’s is likely to change as well.
However, things even then aren't so clear cut.
Earlier this year two teams reported different kinds of calculations indicating that Earth will be swallowed up by the sun. In a calculation that would thrill any college junior studying classical mechanics, Lorenzo Iorio of Italy’s National Institute of Nuclear Physics used perturbation theory. It simplifies analyses by dropping relatively small factors, thereby making complex equations of motions that describe the interactions between the sun and Earth mathematically manageable. Assuming that the sun’s yearly mass loss (currently about one part in 100 trillion) remains small for the duration of its evolution to the red giant phase, Iorio calculates that Earth will move outward at about three millimeters a year, or only 0.0002 AU by the sun’s red giant phase. But at that point the sun will balloon up, in only a million years, to 1.2 AU in radius, thus vaporizing Earth.
The second analysis came to a similar conclusion.
Even if Iorio got his number crunching wrong, he may have the right answer. In an analysis published in the May Monthly Notices of the Royal Astronomical Society, Klaus-Peter Schröder of the University of Guanajuato in Mexico and Robert Smith of the University of Sussex in England also conclude that Earth is doomed, by using more exact solar models and by considering tidal interactions. As the sun loses mass and expands, its rotation rate must also slow down—physics students learn this relation as the conservation of angular momentum. The slowed rotation causes a tidal bulge on the sun’s surface. The gravity exerted by this bulge pulls Earth inward. With such a consideration, the researchers find that any planet with a present-day orbital radius of less than 1.15 AU will ultimately perish.
This establishes there is a potential survival limit for the human species on planet Earth. However, if our species or its descendants can develop the necessary to move the Earth further out into the solar system, then they might continue to survive.
However, if that can't be done or the technological capacity to do so is beyond future humanity, then this is our most probable end-point. Roughly, 5.4 billion years from now.
Lorenzo Iorio, Orbital effects of Sun's mass loss and the Earth's fate, Natural Science, 2: 329-337, 2010.
Klaus-Peter Schröder and Robert Connon Smith, Distant Future of the Sun and Earth revisited, Monthly Notices of the Royal Astronomical Society, 386: no. 1, 155-163, May 2008.