Public Transportation anytime past 9 PM is very unreliable in the Bay Area. If you are flying into either SFO or SJC, I would recommend South and East Bay Shuttle (408-225-4444 / 800-548-4664) to get to Stanford. I belive it is $22 from SFO and $15 from SJC.
As far as housing goes, the SLAC guest housing is probably the most economical method other than staying with a student. It sucks that Stanford MSTP doesnt organize any such student housing. The Marguerite shuttle leaves from SLAC and eventually gets to the Medical center; it may take a while so plan ahead early.
if anyone ever needs housing for a couple nights at Stanford, i live on campus (close to the med center) and have an extra couch in my room. PM me if you can find cheap housing. I've already housed three interviewees because the Stanford MSTP is so disorganized.