I think when you play the best depends upon your personality and the way your mind works (and potentially the day of the week!). Some days I am just NOT in a social mood. On those days, I like to get away in the early evening and play 9 holes by myself as a way to clear my mind. Often, when I am in these moods, I play really well because my mind is not concentrating on golf. My instincts take over and you don't focus on the fact that you have a 5 foot putt for birdie ... you just react and it seems the likelihood of it going in rises. At other times, I play better when I am playing with a group of buddies or singles that I meet on the first tee.
One thing I always try to do, however, is not watch other golfers' swings. I watch where the ball goes to help them spot it, but I don't watch their mechanics. For some reason, my mind sees someone else's swing (good, bad, or indifferent) and subconsciously tells my body to do the same thing ... funny, eh?
In any event, I think the bottom line is that you need to focus on your mechanics, pre-shot routines, strategy, etc when you are practicing. In my mind, there is a fine line between focusing too little and too much while on the course. I tend to try to focus less on the course and let my swing go into autopilot mode from all the time spent on the range/putting green. It is in these times (either with or without playing partners) that I find I play my best.