Some 4.5 billion years ago, there was nothing here but gas: a vast, swirling cloud of hydrogen and helium gas, along with particles of dust, containing heavy elements synthesized in ancient stars and supernova explosions.
This cloud, several light-years across, was probably not alone, but near a region of star-birth and star-death. Perhaps one day, a supernova explosion nearby sent shock waves into this peaceful mass of debris, and forced some molecules closer together into a clump. Soon this clump started exerting gravitational attraction on molecules around it, and suddenly - mass was gathering in the centre of the cloud, getting bigger and attracting more mass all the time. As the cloud was collapsing, it began spinning and forming a disk.
Collisions in the disk created what are known as protoplanets - and after 100, 000 years or so, there was a spinning disk of matter around a hot central mass, that was not yet a star, but was getting hotter because of its increasing density - its mass being pushed closer and closer together.
Though it may have seemed a long time, at every moment more matter was being added to the central mass. Eventually, after around 50 million years, it became large and dense enough for nuclear fusion to begin in its core, converting hydrogen to helium at intense pressures. The Sun began to shine. By this time it had taken 98% of the mass of the cloud, leaving only small amounts of gas, and tiny amounts of heavier elements. These kept smashing into each other as the disk spun round the new Sun, and formed into the planets we know today - though then, they were very different indeed.
After ten million years, the fierce solar wind - a stream of particles ejected by the sun's enormous series of nuclear reactions - died down, having blown away much of the dust in the inner Solar System, and leaving the planets as they were. Inner, smaller, rocky bodies, and outer, larger, gaseous ones.
The Sun has been very much the same since it started burning hydrogen at its core and became a main sequence star. It has barely changed in the billions of years since. Will that continue?
The Sun is about half-way through its life-cycle. It is aging all the time, though we can't see it easily. It is growing brighter, by a factor of 10% every 1 billion years. Why is this so? It is because as it burns, it gets hotter, and as it gets hotter, it burns more rapidly. Eventually its brightness will increase and make life impossible on Earth - in around one billion years' time. By then the Sun will be noticeably larger than it is now, as its outer layers expand with the increased heat.
By five billion years' time, the Sun will swell into a red giant, and could become large enough to swallow the Earth. This process happens because as the core of the Sun gets denser, fusion begins around it and triggers a wave of expansion as it does so. The outer layers, now very far indeed from the core, will cool to around 3000K - half the temperature the surface of the Sun is today.
Eventually the Sun's core will get hot and dense enough to start burning helium, and will then contract again, becoming smaller and slightly hotter. But the Sun is no longer in its youth, and the burning of helium cannot be sustained for as long as the burning of hydrogen - there isn't as much of it. It will burn helium for around 100 million years only. Then it will expand again and will this time start ejecting its outer layers. As it burns the remaining reserves of its nuclear fuel - now hydrogen, helium and carbon, the Sun's core will be flinging its layers away with the increased heat it generates. These layers will eventually break free of the core and dissipate into space.
As it tries to keep burning, however, the core contracts and increases its pressure and temperature. With stars like the Sun, though, there is a limit because they are not massive enough to cause an explosion - a supernova. Instead the core will simply contract and remain as an object the size of Earth but weighing nearly as much as half the Sun's original mass. It will glow hot, and white - a white dwarf.
The white dwarf is mainly carbon and oxygen, though in a very crushed form, and is not dense enough to start burning again as a star. Instead, it will gradually radiate its heat away and end up, finally as a cold black dwarf.
The Sun will begin its life as a white dwarf around six billion years from now: then, after possibly another million, billion years it will cool into a black dwarf. No-one has detected any of these, and they remain hypothetical. White dwarfs since they do not burn fuel, cannot radiate their heat for ever. As a black dwarf, this star that was once 20 million degrees K in its centre will now be just 5 K. By this time, the Galaxy itself will no longer exist, having long ago lost its stars.
What happens to the black dwarf is then anyone's guess. It might evaporate, as its particles break down. But no scientists can be clear yet.
The Sun has a long life - but not an infinite one.