Probably the sun and small scale fusion for at least the next thousand years or so. Eventually other stars/large scale fusion/some type of energy production we haven't discovered yet.
>and space
There is enormous amounts of room left on earth. Everyone on earth could have an acre of land to themselves with 10x the current population, and that completely ignores multi-level construction (either above or below the surface). But long term there is a lot of space outside of earth.