In the traditional view espoused by many advocates of capitalism, the traditional "middle class" (those living by a mix of capital and labor, either applying their own labor to their own capital as small business owners or yeoman farmers, or by having both capital to which other's rented labor is applied and labor which they rent to others -- i.e, an upper-income wage laborer with some personal real estate and financial investments) is idealized; I'm not sure if there is a substantive reason for this so much as a PR one, though -- its something that the working class can somewhat understandably (even if not always plausibly) aspire to and the existing middle class can identify with. But, if you look at most of the criticisms of capitalism, they mostly focus on the problems that exist in the relationship between the capitalist class and the working class, so the more of the population that is in the middle class -- which is both less subject to exploitation than the working class and less capable of it than the capitalist class -- the less the problems associated with capitalism are.
Note, however, while this idealization of the "middle class" remains in the US, the definition of middle class in many media uses (including this article and the supporting research) has drifted to refer to a range around the "middle income", which is very different from the traditional concept of middle class; most of the people in this band are firmly in the working class, with only the top-end of most median-income-centered definitions of "middle class" containing people that are plausibly in the traditional middle class.
One book that covers this well is World on Fire: https://www.amazon.ca/World-Fire-Exporting-Democracy-Instabi...
Additionally, the discretionary spending of middle class households helps fuel the economy.
Sources?
This means a lower probability, all other things being equal, that a majority-supported position will be extremely unwelcome by a large minority, which is probably a good thing for a democratic state.
Political influence, time, land, attractiveness, power, etc. are all about sorting you relative to others. No matter how much new "wealth" there is, everyone can't have the same lobbying influence and live in Manhattan.
The middle is the padding/margin that keeps the possibly of moving up and out of your class a seeming reality, but also keeps the divide from rich/poor from being too strong. If you just have rich/poor, the opportunities seem more dire, less opportunity and less mobility is possible and lots of bad things start to happen.
A society that tends to the middle is a more healthy one, one that tends solely to rich/poor needs leaves those middle people out of luck, that is what we have now.
This is also a consumer economy, the lower/middle spend over $1 or 100%+ of their incremental dollar earned, the rich only spend .05 or 5% of their incremental dollar. It is good to have consumers that can spend in a consumer economy, it helps all levels of class/wealth. Rich/poor do not spend enough to keep a consumer economy afloat that actually moves money the way it is supposed to move and you end up with stagnation and long drawn out recessions. In downturns, the poor have no money and the rich don't spend or invest in downturns enough, the middle always has to spend.
If you sell products it is also nicer to have middle class out there that can buy, not just upper class. The products that target each are fairly different and there are only so many rich consumers.
The middle class has enough material wealth to have "something to lose", but not enough material wealth to individually upset the status quo too much. On top of that, there are enough resources to go around to allow a large group of people have that same approximate level of wealth.
Ergo, the middle class is a tremendous stabilizing force in a society, and they're "guillotine insurance" for the rich.