In my opinion, for what it's worth, it's time, time time for a time out.
My daughter had far more drama with neighborhood girls than my son ever did and they always wanted to be at my house until another kid came a long. We invited my daughter's best friend to come over for a family bbq, planned in advance, including a sleepover and things were fine until another girl came and knocked on the door from a few blocks over that we didn't know.
Well, the girl went to my daughter's friends house first, mom said her daughter was at my house (instead of saying her daughter wasn't available to play), and to make a long story short, the girl talked my daughter's friend into going to her house instead. She packed up her stuff and left. I called the mom just so she would know that her daughter had left with another girl and wasn't in my care any longer and left it at that. Her mom didn't say she was sorry or send her daughter back over or anything. It hurt my daughter's feelings.
So.....I imposed a time out. Not because my daughter did anything wrong, but because I would never have allowed my daughter to do something like that. Just walk out on someone and plans because someone else showed up. I turned my daughter's friend away for two weeks every single day she came over and wanted to play. She came over in her bathing suit and wanted to swim. I told her I was sorry, but she would have to go back home...my daughter couldn't play right then.
Ironically, the mom confronted me about not being nice to her daughter.
I was never rude to her daughter. And I found it strange that plans we had made in advance were scrubbed when a different girl came to collect her daughter's things to take her somewhere else and her mom saw nothing wrong with it. Her mom never called me to say plans had changed. I would have invited the other girl at least for dinner, but she was on a mission to get the other girl out of there and that's the way it went. So...two week time out. My daughter and her friend made up, but that other girl still came to the house looking for Ali and wanting her to leave. When she did, I packed her stuff up and sent her home because she never once said she wanted to stay. She never once said, "I'll play with you later, I'm here for right now"..
She would just get up and go.
I didn't think it was polite at all and I didn't harp on it too much, but my daughter got a really good lesson on how NOT to treat people.
You have the right to turn any child away that comes to your house.
You have the right to explain to your son that not all kids can play nicely together and even if he feels left out sometimes, he will know some compassion and not treat other kids that way.
If he is not being treated nicely, there is nothing wrong with him excusing himself to come home.
If they can't play nicely, and he gets to be the third wheel, well then, they can function on two wheels. If you know what I mean. My daughter was very social and loved her friends but I taught her manners and ettiquette and some kids don't have that. In some situations, I got to where it wasn't my place to teach other kids nice manners.
Your son should never feel so hard up for friends that he will take being treated badly. Not all people will treat him that way.
A new batch of friends who can get along might be just what he needs to get his self esteem and inner strength rolling.
Get him into a martial arts class or something. It's not about fighting, it's actually about self restraint and thinking about your inner peace. I think it's good for boys.
Some kids are opportunists. Sad as I am to say that.
They might not like your son, but if there's no one else around, he'll do in a pinch.
I never had much patience for those types of kids around my own because I didn't want my kids to act that way.
I hope you get some great responses.
Best wishes.