The 9 county area of the Bay Area is 7000 square miles... and that includes a lot of land that you can't reasonably build a city on.
If you take the land area of the cities in the Bay Area ( https://en.wikipedia.org/wiki/List_of_cities_and_towns_in_th... ) and sum them all up, you've got something on the order of 1,600 square miles.
The land constraints within the Bay Area contribute significantly to the price of a house.