Note: Earth's 31st- (and very nearly 32nd-) century population is an order of magnitude larger than than anybody expected a thousand years or so earlier. Twenty percent of Sol System's trillion-ish sophonts live on Earth. Population density is measured in people per cubic kilometer, rather than square kilometer, and most cities go down a kilometer or more, and go up at least three. These massively arcological megalopoli only occupy about 10 percent of Earth's land masses and their deep gardens supply all the food they need. The rest of the land is carefully managed, sort of like a series of continent-sized national parks.
Cities are found in the sea, as well. Sea-states like Dom Atlantis typically go down at least two kilometers, and the oceans around them are managed just as thoroughly as the land is.
A combination of technologies make this possible: annie-plants ensure sufficient energy, and what used to be called "agriculture" is no longer solar-powered. Ultra-strong construction materials make these giant cities far more stable than anything seen in the 20th or 21st centuries. Finally, inexpensive space travel opened up new frontiers, which relieved certain societal pressures enough to allow for several hundred years of at-times-explosive population growth.
There are other ways to fit 200+ billion people on a planet, but this is one of a very few ways to pull it off while still having it be useful as a planet.