Please try not to show your anxiety to your son. It's hard I know....I've been there.
But if you show your anxiety then it will make it twice as bad.
No grilling him after school with "Who did you play with?" type questions. None at all.
Just "How was today? What was the best bit?"
And I'd like to add, seeing him wandering alone is triggering for any parent but I'd bet that most if not all kids have some moments like that during their day.
They're not all constantly together.
Whatever he likes doing...whatever he is good at, encourage him in that 100%. Get him in clubs...whether it's art, drama, chess...singing...something that can be 'his thing" this is a great way to build confidence and it's what I did with my DD at this age when she was going through similar.
It's very, very common. As they hit high school age, there's always change in friendships.
Keep encouraging him to be himself. Often at high school, they find other kids who aren't part of the loud crowd, My DD really came into her own in high school.x