well... it wont really run out of energy as such, but here goes...
The sun is a star and all stars have life cycle's. To cut a long story short, every star gets bigger and bigger until it becomes a Red Giant Star. By this time it will have swallowed the earth up. it will then become either a White Dwarf, or a Neutron Star and Gas Cloud.... Hope that was helpful!