Eventually, the temperature in these layers becomes high enough for hydrogen fusion to take place in a shell surrounding the core. This produces additional energy, which helps support the outer layers of the star. Meanwhile, the core continues to contract, becoming denser and hotter.
Eventually, the temperature at the centre reaches around 100 million kelvin, allowing helium nuclei to begin fusing together to form carbon. Some of this carbon can then combine with further helium nuclei to produce oxygen.
The energy released by helium fusion, together with the increased energy production in the surrounding hydrogen-burning shell, changes the balance within the star. The outer layers expand enormously, and the star becomes a red giant.
When the Sun reaches this stage, its core will have contracted considerably while its outer layers expand so far that its surface may approach or even extend beyond the Earth's present orbit. The Sun will therefore become an enormous red giant, although the precise extent of its expansion is uncertain. It will pass through its giant phases over a period lasting hundreds of millions of years or longer.
Eventually, the helium in the core becomes depleted, leaving a core consisting mainly of carbon and oxygen. With helium fusion in the core no longer producing energy, gravity causes the core to contract again. In stars with masses below roughly four times that of the Sun, the temperature does not become high enough for further nuclear fusion in the core to take place. However, the contracting core heats the surrounding material, allowing helium fusion to continue in a shell around the carbon-and-oxygen core. This helium was produced earlier by hydrogen fusion in the surrounding layers. Outside the helium-burning shell, a further shell of hydrogen fusion can also develop. The energy produced by these surrounding shells causes the star's outer layers to expand further, prolonging its giant phase.
In more massive stars, the temperature of the contracting core can rise to around 600 million kelvin, allowing carbon fusion to begin. During this stage, carbon nuclei combine to produce heavier elements, including neon and magnesium. Meanwhile, hydrogen and helium fusion can continue in shells surrounding the core. Eventually, the carbon in the core becomes depleted and carbon fusion comes to an end. In stars that are not massive enough to progress to the next stages of nuclear fusion, the core contracts again, but its temperature does not become high enough for further nuclear reactions to take place. The core is then left containing mainly heavier elements, while fusion may continue for a time in the surrounding shells.
Note that each successive period of hydrogen, helium and carbon burning takes less time. As the star exhausts each fuel, its core contracts and becomes hotter and denser, allowing the next stage of nuclear reactions to begin. These later reactions generally require more extreme conditions, and the fuel is consumed at a much greater rate. Although the energy released by individual reactions also varies between stages, the main result is that each successive stage of nuclear burning lasts for a shorter period.