The Sun in Equilibrium
The Sun has been shining, radiating energy for about 4.5 billion years and will continue to produce energy at about the same rate for another 4.5 billion years.
The Sun is in a state of equilibrium, with the Sun's own self gravity tending to contraction balanced by gas pressure (because the Sun is basically a large ball of gas) and radiation pressure, because electromagnetic radiation or photons, produced in every fusion reaction that powers the Sun, carry momentum and so exert a pressure when their direction changes. On average, the radiation pressure will tend to oppose contraction, because the density of photons, and the energy of photons becomes greater towards the core. The photons act in this way, a little like a gas.
The equilibrium is dynamic. If the core heats up a little, then it expands, so the particles in the core tend to get further apart, so the gas pressure falls. The rate of nuclear fusion reactions also decreases because the reactant particles are further apart, so less photons are produced. The radiation pressure falls too. Equilibrium is established at a slighter higher core temperature and larger core radius.
If the core cools a little, then it contracts, so the particles in the core tend to get closer together, so the gas pressure rises. The rate of nuclear fusion reactions rises because the reactant particles are closer together, so more photons are produced. The radiation pressure then rises too. Equilibrium is established at a slighter lower core temperature and smaller core radius.