Hydrogen fusion to helium is the primary energy source for main sequence stars. That something is the pressure of ever-hotter and denser layers of gas as you go deeper into the star. Thus, you can have high density while at the same time have particles very far apart compared to their size, acting like an ideal gas. The increase in temperature as one goes down into a star reflects the necessity of transporting the energy generated at the center of the star to the surface. This is not a very important mechanism in the sun, but it can become important in some circumstances we'll run into later.
Hot gas is moved, and then shared out with surrounding cooler gas, thereby transporting heat energy.
It takes a few hundred thousand years for energy to reach the surface by this tortuous route. The amount of energy flowing by each of these routes is determined by the nature of the stellar material, and different mechanisms are generally important at different depths. A speculation by Vogt and Russell early in this century has been born out by our fuller understanding of the way stars work. Their idea was that if one specified the mass, composition and age of a star, then it should be possible to figure out the star's luminosity, radius and surface temperature. Today we can make such model stars in the computer, and the Vogt-Russell theorem works.