Everything in moderation. When I worked from home for 5 years (in a company with the same distributed ethos as Basecamp 10 years back) it was easy to become extremely socially isolated if I wanted to. And it happened a couple of times over that span, but recognizing the balance of good mental health spun that back into a balanced state. (To be sure, my wife was immensely helpful about recognizing it and forcing me out the door more.)
I've been working in offices again for the past, I don't know, 7-8 years now which initially gave me some whiplash as an introvert finding himself working in a position where extroversion tends to rule the day. Nowadays, however, I have a little electronics workshop in my basement where I can scurry off to and think with clarity all to myself after the day is done. It's rejuvenating and gives me a stronger sense of worth and balance in my overall mental health.