By the end of there journey it's obvious that they care about each other and are very close friends, but how close were they before they set off for Rivendell and to destroy the Ring of Power?
Sam was a servant of the Baggins' of Bag End (who were land-holders, and therefore wealthier and higher up in the social standing of the Shire). Specifically, he was their gardener.
Sam grew up around the Baggins', as his father (Hamfast Gamgee) was their gardner at the time. I daresay when he was growing up, Hamfast made sure Sam called his Masters 'Mr Baggins' and Master Frodo as well (It would've been Master at the time, as he grew up they would begin to refer to him as 'Mister').
However I believe growing up around the same age, Frodo and Sam were close(r) than you would usually see in a Master/Servant relationship. They still weren't "friends" per se, Sam, with his more serious and sombre nature, still saw the relationship as more professional.
Frodo, who is a lot more extroverted and open, seemed to treat Sam more as a confidant (I remember a part at Bilbo's party where Sam and Frodo discuss Sam's love interest, and Frodo has a laugh with him and jokingly pushes him onto the dance floor with her.
So in conclusion, I would say they were close, but not entirely 'friends'. Frodo most likely 'hung out' with other Hobbits of Gentry (Merry and Pippin perhaps?).