SOME big American cities are flourishing as at no time in recent memory. Places like New York and San Francisco appear to be richer and more dazzling than ever: crime remains low, new arrivals pour in, neighborhoods have risen from the dead. New York is in the throes of the biggest building boom in 30 years, its population at an all-time high and climbing. Mayor Michael R. Bloomberg proudly promotes his city as “a luxury product.”

But middle-class city dwellers across the country are being squeezed.

This time, they are being squeezed out by the rich as much, or more so, as by the poor — a casualty of high housing costs and the thinning out of the country’s once broad economic middle. The percentage of middle-income neighborhoods in metropolitan areas like Los Angeles, Chicago and Washington has dropped since 1970, according to a recent Brookings Institution report.

The percentage of higher-income neighborhoods in many places has gone up. In New York, the supply of apartments considered affordable to households with incomes like those earned by starting firefighters or police officers plunged by a whopping 205,000 in just three years, between 2002 and 2005.

Does it matter if there is less room for a middle class? In strictly economic terms, plenty of economists say, it may not. But they also say that in the long run, those cities may become places where they and other city lovers would prefer not to live.