Why does the gas in Sun's outer layer not expand? Since in the outer part of sun it consists gases. Why don't the gases expand due to heat? This was asked by my friend.  And he said that the gases are attracted by the plasma layer by a force. So the gases dont expand and the sun does not get significantly bigger. I think some details would help me out.
 A: 
Why does the gas in Sun's outer layer not expand?

The Sun's mass acts to pull the gases inward. Meanwhile, the pressure from below acts to push the gases outward. The Sun is very close to being in a state of hydrostatic equilibrium. At any point in the Sun, the weight of all of the stuff above that point is more or less equal to the pressure at that point. Mathematically, $\delta P / \delta r + \rho g = 0$ : The pressure gradient is in balance with density and gravitational acceleration. A negative feedback relation (negative feedback is a good thing in physics) keeps the balance stable. Excessive weight or underpressure at some point results in contraction, thereby increasing pressure to restore the balance. The opposite happens where the weight of the material above is less than pressure from below.
There are a number of other balances within a star. One is an energy balance between energy lost due to radiation (i.e., sunlight) at the surface and the energy produced due to fusion in the core. The temperature at a star's surface and the star's surface area determine the rate at which the star loses energy due to radiation. The temperature and pressure at the core determines the rate at which the star produces energy due to fusion. at the core. To be stable, this must equal the amount of energy the star produces in its core. Negative feedback also applies here. These and other negative feedbacks are why our Sun has been shining for several (4.6) billion years, and will continue to do so for several billion more.
The question asks about the Sun's outer layer. If the question is asking about the Sun's corona, that arguably is not in hydrostatic equilibrium. The Sun occasionally belches large quantities of gas, sometimes incredibly large quantities of gas. Most of this falls back toward the Sun as the pressure in the outer layers is negligible. But sometimes it doesn't. The Sun currently loses about $3\times10^{-14}$ solar masses every year in the form of solar wind.
The concept of hydrostatic equilibrium also applies to the atmosphere of the Earth, the Earth's oceans, and even the interior of the Earth. It does not apply to objects less than ~500 km across. The self gravitation of these small objects is too small for the object to pull itself into a roundish shape. Roundness is one of the distinguishing characteristics of a planet.
