See my calculation here, for Chicago (using 2000 numbers): https://docs.google.com/spreadsheet/ccc?key=0Ak1exuXV7898dDR...
As of 2000, about 871,000 people (one San Francisco) lived in Chicago neighborhoods cumulatively as dense as the Mission (~25k/square mile). About 2.4 million people (three San Franciscos) lived in neighborhoods cumulatively as dense as San Francisco (~17K/square mile). Put another way, if San Francisco (~47 square miles) was as dense as the densest 47 square miles of Chicago, it would have 23,500 people per square mile and 1.1 million people.
Chicago is officially much less dense than San Francisco because the way the boundaries are defined, the city proper stretches 20 miles along the lake shore, two-thirds of the way to Gary, Indiana. San Francisco, meanwhile, ends quite abruptly part-way down the Peninsula. But if you look at the population density weighted by the populations of neighborhoods, Chicago is more dense.
Interestingly, Chicago has no reason to be so dense. Aside from the lake, it's flat, easily-built land as far as the eye can see. It's just that historically Chicago has had lax zoning regulation and that has resulted in more density.
It depends on what you're trying to measure, really. If you're talking about space constraints driving up housing prices in the core city, I think it's useful to look at density in the core city and whether it could be higher to create more supply.
Oakland is very much not the geographical equivalent of Brooklyn (you might be able to make some sort of argument for the Bronx or Staten Island). San Francisco is not more densely populated than Manhattan, neither is, by a long stretch LA.
San Francisco has half the population density of Brooklyn and less than Queens or the Bronx. It's also less than Somerville, Massachuetts or West Hollywood in LA county.
People talk about having more people in San Francisco and they think of Manhattan, but there's actually a lot of room for increased density without looking like Manhattan.
One problem is that density is much lower in places like the Outer Sunset, in part because there's no cross-town subway. Total SF population could be increased significantly if the western half's population density could be brought up to what's already the case in the eastern half.
Which will beget the subway.
As it is there is neither the political will, nor the practical population, to support such a thing.
Compare that to, say, Palo Alto, where housing is in strong demand (due to Stanford and startups) and yet they've only allowed density to reach a paltry 2,500/sq.mi. If they allowed high-density housing near downtown Palo Alto and Stanford, it'd not only improve things on the peninsula, but also reduce some of the pressure on SF housing from people who currently reverse-commute.