Our ds when in 1st grade first became aware of not fitting in, and seldom played with other kids. He did and does fine one on one but there was something about recess/large groups which really did not click for him.
In 2nd this became even worse, and it was at least a couple times a month if not more that he would mention having 'no friends' or being lonely and of course with that, hating school, etc.
Part of it probably was thinking everyone else was having a great time. But even at family events I have seen him drawing away a bit and sort of circlingt he crowd. Considering this was getting worse and not better for him, when we decided to get an assessment recently, we went for something which would also help us answer questions about social issues. Even though we have not gotten a full write up yet from the doctor, and don't know if he's going to diagnose, we have had some good tips which have helped already (for our ds, your mileage may vary, as they say).
- the first 2 of these were sort of shocking to us, hope they are not so shocking to others -

1. Don't always encourage ds to be as unique as possible. (he's going to be out there anyway, he doesn't need to be super-duper out-there completely beyond reach... Hard to swallow, but I sort of see the logic. This was in part regarding ds in ballet, ds interest in things like medieval swordplay rather than baseball, and so on.
2. Consider letting him have a Nintendo DS (dsi). That hand-held game system that is taking over all the 7-14 year old brains in the u.s. We got one, immediately ds said something like, 'great, now I'll fit in better'. Seriously, he does fit in better.
In addition to being a conversation starter/continuer, he has a lot more stuff to think about on his own, and doesn't pester people to death, at least not so often.
3. More play dates (this was one I had thought of previously,but the dr. confirmed )
4. Role playing to learn about how to get conversations started and keep them moving. With an outside conselor or group if need be, to get him comfortable.

In addition we applied to the gt program at the school and that has really really helped him feel better about school and finding friends.

This is a tough problem ~ good luck!