Heliologists predict the sun will last for at least another five billion years. The sun has lasted as long as it has because it acts as a nuclear reactor that turns hydrogen into helium.
The sun is comprised of hydrogen and helium in a plasma state. When hydrogen and helium combine, the reaction gives off energy. The center of the sun is hotter than 15 million Kelvin. It has been burning for an estimated five billion years; in another five billion years, it will use up the majority of its hydrogen and become a red giant. After that happens, it will only be a matter of time before the sun collapses down to a white dwarf.