A New York Times article asking how many people Manhattan could hold notes that "packing Manhattan as tightly as Kowloon Walled City, river to river, would mean jamming in 65 million people."
I think in a lot of ways it's more illuminating to think about less extreme scenarios. Consider New Jersey, which is hardly a jam-packed tenement. It nonetheless contains five times as many per people square mile as California. In other words, if the Golden State were as dense on average as New Jersey over 188 million people would live there. And California is a mighty nice place to live. Thanks to its mild weather, Californians use very little energy to heat and cool their offices compared to most Americans. According to 2005 data, the average Californian had half the carbon footprint of the average American for roughly this reason. And yet a California that existed at a New Jersey level of population density would have even lower per capita CO2 emissions since many car trips would be shorter distances and a larger share of the population would be walking/biking/transiting around some of the time. And while of course this would be a dramatic transformation, my point is that unlike imagining Manhattan as Kowloon Walled city it's not a crazy idea. New Jersey isn't some bizarre slum arising as an accident of history. New Jersey's not even particularly crowded! Indeed, its small cities (Trenton, Newark, Camden) are all well below their historical population peaks.
Needless to say, my book gets into this in more detail.