you don't run out of energy, you run out of USABLE energy. That may or may not happen, if humans somehow manage to become a type two civilization, it's almost never happening, because if a civilization becomes type two, they can harvest all of the energy produced by their sun. And if the human civilization becomes a type two, they're going to become type 3 well before the sun runs out of gases. If we become a type 3, we can use all energy from every part of the universe.