How does the Sun work?
Top 12 in Top 12 Questions About the Sun Answered
The Sun's balance is maintained by the mutual gravitational pull of all its atoms acting to compress the solar core. These gravitational forces generate and contain the nuclear events occurring there. The solar atmosphere beyond the energy-generating core adapts to transport the massive quantity of energy that radiates from the surface.
This is the fundamental concept behind the existence of all stars, from gravitational attraction and the compression of a gas cloud through the start of nuclear energy generation and, eventually, to the exhaustion of nuclear fuel and the star's death.