The answer to this explains the existence of the main sequence in the H-R Diagram and leads into the next big topics the Formation and Evolution of Stars.
This is not very efficient!
Lifetime is given by taking the total energy available divided by the rate at which you are using up the energy.
where R is the radius of the ball of gas, M is the total mass and G is the ``gravitational constant''.
Similarly, if because the Earth exerts a gravitational pull on objects at the surface and in space, objects all have an associated GPE.
This is about 250 times more efficient than chemical burning.
This converts to 16 million years - still too short! The Earth is around 4 billion years old (plus the Sun would have been much bigger in the past).