A lot of it depends upon how we live. I've heard using things like vertical farming powered by atomic energy, recycling virtually everything, plus living in high density developments, the planet can support about 1 trillion humans (beyond that we just plain run out of room). Living as we do now on average, the long-term sustainable figure is closer to about 2 billion. If everyone lived like we do in highly developed countries, I'd put the figure at well under 1 billion. The good news is with birth rates going down as countries become developed, the population is projected to stabilize somewhere around the 10 billion mark. Earth can sustain this many people in comfort provided we change how we do things. More recycling, more efficient use of energy, renewable energy sources, growing food locally, traveling less, and denser living at this stage are pretty much necessities if humanity is to survive past the 21st century. Remember if we don't change, nature has a long history of reducing surplus populations. Unlike other creatures, humans are aware of this fact. They can thwart nature's will with careful planning.
What really scares me most in the short term are developing countries like China and India trying to emulate the USA of the 1950s. Earth just doesn't have the resources for about 2.5 billion people to have a house in the suburbs, a car, and roads everywhere. China has built a nice high-speed rail network and local rail transit. Unfortunately, they also chose to build a highway network. The irony here is if everyone there drove, these new roads would be so packed you wouldn't get anywhere. China had a great opportunity to bypass the automobile era, with its attendant problems, entirely but instead decided to ignore reality. Hopefully India won't make the same mistake.
In a nutshell then, I'd say the single biggest solution to any population problem is to redefine at a societal level what success means. If we can get past the notion that success equals ever more material things, then humanity has a good chance.