Getting Class B clearance over the Peninsula is beyond easy. Don't bother avoiding. Almost always, they will want you at 1500 or 3500 and to stay west/south of 101 (that's the highway directly alongside SFO). That gives you half the airspace to deal with.
Oakland Center won't give it to you, though. You have to wait for the NorCal handoff. You can ask for an early frequency change if you want.
Basically, head straight for SAU VOR and visit the Golden Gate Bridge, Alcatraz, and downtown as you prefer. Aim straight for Crystal Springs (long skinny lake pointed directly away from you) after you enter Class B (most of the city is below the 2500 shelf).
The only real gotcha is the stadium TFR. If the Giants are playing, downtown will be off limits.
You can also go through the Oakland C, but the altitudes are lower, it's more susceptible to mechanical turbulence, it is MUCH more constrained, the SFO B is very close above (NOT the usual 4000 and you are not likely to get clearance in that part of the B), and you have to know the visual checkpoints, especially the Coliseum and Mormon Temple.