Now consider what is happening to the center of the Sun during this time. Because the heat is leaking out, the center of the Sun is becoming cooler. This cooler temperature means that the gas pressure is becoming smaller, and there is less force to resist the pull of gravity. So the outside of the Sun shrinks a little. This additional shrinking reduces the radius of the star and, consequently, puts the Sun's center under a bit more pressure.
More pressure means more temperature.
More temperature means more heat and more radiation, which then leaks out. And the process continues. William Thompson, better known as Lord Kelvin, considered this scenario in the middle of the 19th century. He realized that the entire energy of the Sun could be produced if the Sun was shrinking about 1 centimeter per year. He also calculated that through gravitational contraction, the Sun could successfully maintain its luminosity about 40 million years.