Hotels near the airport are cheaper than in the city. BART from the airport to SF is pretty convenient. You might be able to save some money that way but be more comfortable than a hostel. Some hotels include breakfast in the price which can also help.
Alternatively, look on AirBnB or Craigslist for someplace big enough for all of you to share. It might work out about the same as a hostel but would probably be more comfortable. Just be sure to check what part of the city they're in and what your transit options will be from there.