For the student/backpacker/socializing crowd, Hostelling International has 3 hostels in San Francisco (
link here)
Plus, I've stayed at the one at Marin Headlands (
link here) which is only 20 minutes north of the city, across the Golden Gate (near the beach at the Marine Mammal Rescue Center -- sad but very cool tour!). The one at Montara Lighthouse (
link here) is also incredibly scenic, 25 miles south of the city.
They have dorm lodging ($15-22) or private rooms ($45-60), but what I like most is that people from all over the world mingle in the kitchen and lounge areas. Great place to get local info, trade stories, play Scrabble and make spontaneous friends from five continents. So many languages being spoken in one place! The hostels have organized trips into the city a few nights a week, group activities and such, for anyone who happens to be around. Friendly outgoing people!
I have no affiliation with H.I., but just like 'em.
When driving, looks for the signs with the little house on it: