If we discount risks that are not foreseeable in the long term, such as wars, epidemics and asteroid impacts, the amount of time our planet will remain habitable is limited by the life cycle of the sun. Our sun has sufficient hydrogen reserves to burn for another five billion years. However, the Earth will already have become inhabitable by this point, as the intensity of solar radiation will have slowly but steadily increased. In two to three billion years, it will be so hot on our planet that the oceans will evaporate. Then life will no longer be possible here.
Henning Krause from the division Communications and Media Relations from the Helmholtz Association answered this question.