[Pulsar's answer][1] is indeed correct, but let me expand a bit more. What happens when a gas giant shrinks? ---- A uniform mass will have a [self gravitational potential][2] of $-\frac{3GM^2}{5R}$. If we decrease its radius, its potential will decrease as well and the difference will be turned into thermal energy. Although gas giants and stars are not uniform mass balls, their gravitational binding energy is still proportional to $\frac{GM^2}{R}$, Thus if the radius decreases it will release energy, which will raise the temperature in return. What happens when the temperature increases? ---- Assuming the gas in those planets obey the [ideal gas law][3] $$PV=nRT$$ (where $R$ is not the radius but the molar gas constant $R=8.314\,\text{J K}^{−1}\text{mol}^{-1}$), it's obvious that when $T$ increases and $V$ decreases (due to the shrink in the previous section) $P$ must increase. Note that most real gases behave qualitatively like an ideal gas, so this is not a crazy assumption. So what is the big picture? -- The planet shrinks a little bit, the potential difference turns into thermal energy and its temperature rises. The rise in temperature will cause the pressure to rise and prevent the planet from shrinking further (holding the planet in [hydrostatic equilibrium][4]). However, the planet also loses energy due to EM radiation as well, so it will continuously shrink and radiate. The process is called [Kelvin–Helmholtz mechanism][5]. For instance, Jupiter is shrinking the tiny bit of $2\,\text{cm}$ each year. Although you might think this is really nothing, the amount of heat produced is similar to the total solar radiation it receives. [1]: https://physics.stackexchange.com/a/71435/24791 [2]: http://en.wikipedia.org/wiki/Gravitational_binding_energy#Derivation_for_a_uniform_sphere [3]: http://en.wikipedia.org/wiki/Ideal_gas [4]: http://en.wikipedia.org/wiki/Hydrostatic_equilibrium [5]: http://en.wikipedia.org/wiki/Kelvin%E2%80%93Helmholtz_mechanism