Scientists expect the sun to burn for another 5 billion years. However, just because the sun continues to burn does not mean that Earth necessarily remains habitable.
Scientists of astronomy believe that after 2 to 3 billion more years, the sun's radiation has the potential to increase so dramatically that it ends life on planet Earth. Five billion years from now, the sun's hydrogen core may be depleted, causing the sun to expand greatly as a Red Giant. From that point on, it could engulf the planets all the way up to Mars before continuing its multiple-billion year death. After this, the bloated sun may collapse into itself as a White Dwarf that is roughly the size of Earth.