That's a difficult thing to balance. I'd say the first step is setting boundaries. A hardline stance is "work at work, socialize outside of it," but you'll find that work life and social life naturally share some overlap. Just consider what you most want out of work and your social life, then set your boundaries from there.