SF is similar to Boston and Philly in that there's a lot of high density neighborhoods outside of the immediate core.
Density here is in the 40-60k ppsm range
https://www.zillow.com/homedetails/1810-Jackson-St-8-San-Francisco-CA-94109/15073578_zpid/
Density here is in the 30-60k ppsm range
And further out
Density here is in the 20-40k ppsm range
https://www.instagram.com/p/C12e0oNPqO9/
And even further out
Density here is in the 20-50k ppsm range
https://www.redfin.com/CA/San-Francisco/483-Paris-St-94112/home/777201