Former Bay Area resident here, who makes yearly trips back there.
I personally see nothing wrong with staying somewhere in the East Bay during the second part of your trip. BART is reasonably good if you avoid peak hours (just keep in mind that the last train out of the city is around midnight and the next won't be until 5~6 AM). Bring a jacket or sweatshirt. Yes, I know you're going in late spring, but it doesn't matter. Good restaurants to hit are
North Beach Pizza in North Beach,
Izumiya in Japan Town (I like the okonomi-yaki, but the sauce on it is
very strong, so be warned), Sophie's Cr?pes right next to it (my favorite is order 'J': vanilla ice cream with banana slices, whipped cream, and chocolate sauce), and
Spiazzo Cafe in West Portal (it is hands-down the best Italian restaurant I have ever been to. I almost feel bad mentioning it in a public post instead of a PM for fear of it getting too popular and crowded, but they deserve the business). As far as coffee is concerned, I liked
Java Beach down by the ocean, and
Blind_Io seems to really like
Philz Coffee.
As far as museums go, there are plenty, like SF MOMA, de Young, the California Academy of Sciences, etc., but the one you absolutely
must see, in my opinion, is the
Exploratorium. It's the same sort of thing as the Palais de la d?couverte (hands-on science museum), but I've been to both and I think the Exploratorium is much better. For sights, Fisherman's Wharf is a bit tourist-trappy, but still fun to walk around, Golden Gate Park is a nice relaxing place to be (plus, it contains the de Young and Academy of Sciences) and is a nice walk to the beach, and Japan town is great, especially if you're an Anime fan. Oh, and when Top Gear went to San Francisco, they started off on Twin Peaks, which gives a great view of the city.
I hope you have a great time in San Francisco, and you'll see why some of us like it so much.