The number of people who can enjoy a contemporary western standard of living sustainably, or with a minimal impact environmentally, is going to be pretty small. Before industrialisation the world's population was almost always under 500 million. That was largely because of both a lack of food and medicine. You need to consider that the problem now isn't the size of the population per se, but rather the minority who are using the majority of the world's energy - I'm talking about you, dear internet user!
Either you strictly keep economic development to an absolute minimum, and can have more people, or you have a good standard or living and have far fewer people. Fortunately there's already plenty of analysis written on these issues. I however would err on the side of the most pessimistic figures. Unless we can develop cheap and plentiful energy (like fusion or something) then that's always going to be a problem because right now development and consumption is not sustainable. So your figure is probably going to be less than two billion people.
A 2012 UN report summarised 65 different estimated maximum
sustainable population sizes. The most common estimate was eight
billion, a little larger than the current population. But the
estimates ranged from as few as two billion to, in one study, a
staggering 1,024 billion.
http://www.bbc.co.uk/earth/story/20160311-how-many-people-can-our-planet-really-support
Of course that's the optimistic view, for the pessimistic you may also want to investigate "ecofascism". Pentti Linkola's ideas are pretty much as extreme as they come. He advocates the mass murder of most of humanity, firstly by using WMD upon cities, and then enforcing strict controls over the economy and population growth via an ecological dictatorship. And stuff like migrating people from the developed world to the less developed world, and vice versa, to thin the population averages. Basically he's a green Pol Pot.
His motivation being the idea that capitalism and industrialisation cannot be separated from the destructive effect they have on the planet. Therefore radical action is required to deindustrialise humanity. This will reduce the maximum human population to at best half a billion, but if you want to encourage reforesting to encourage biodiversity it's going to be much lower still to reduce the demand for farmland.
https://en.wikipedia.org/wiki/Pentti_Linkola
Given this context, in answer to your question. Firstly, you'd need to enforce serious quotas on land and resources (like fishing) to preserve them. Which would help biodiversity return as pollution and exploitation is reduced. You'd also need to go with technologies which reduce strain on resources; like having lab grown burgers, or simply having people develop a taste for fried crickets rather than steak. As in terms of energy efficiency, the land and energy required to raise cows and chickens and such required for slaughter is non-trivial; like you mention vegetarianism for social reasons.
Secondly, you'd very much need an iron fisted political regime to enforce both technological advancement (green technologies, lab burgers, fusion, etc) and also to reduce population growth and energy use. This will also probably require social changes, like aforementioned change in taste of food, and also for people to become more energy efficient in how they live... like opting to live in flats rather than sprawling suburbia. You might have to enforce changes like banning home and land ownership. You'll definitely need to throw everything you've got at reducing the population. Child quotas, contraceptives/sterilisation, and importantly good comprehensive sex and relationship education. Possibly yes, encouraging euthanasia at a certain age, which reminds me of an episode of Star Trek TNG where they came across a society where almost everyone chose to die come age 65. Bottom line, you'll have to do radical changes one way or another in almost every aspect of society as we know it.