You've received great replies above. smile

I see five possible issues involved -
1) need for expanding emotional vocabulary
2) need for appropriate academic/intellectual challenge
3) need for intellectual peers
4) need for realistic expectations
5) need for acquiring self-management skills

Teaching/learning emotional vocabulary has come into the spot light in recent years. There are many online lists and charts showing families of words. While adults seem to regard emotions as complex, there are resources geared for children (including preschoolers) to help them learn the nuance and degree of various emotions.
- a chart by Tom Drummond
- a wheel diagram on British English Coach blog
If your child enjoys writing and/or doodling, keeping a journal may help. It can also be helpful to have a special time built into the family routine to talk about the day. For example, all family members might talk about their day and ask about each other's day, while eating dinner together.

It is good that your child enjoys an appropriate academic and intellectual challenge; when a child gives up on this and decides it is easier to coast and/or blend in, they can become underachievers and develop a host of difficulties. Might sharing the article 'What a Child Doesn't Learn' with the school possibly help in your advocacy? To help your child enjoy appropriate intellectual challenge, it may help to have one or more hobbies which he can immerse himself in and work at independently for a sizable length of time.

The article linked in this old post, includes the importance of having intellectual peers. With these statements highlighted, this article may also be helpful for advocacy. To help your child enjoy the company of intellectual peers outside of school, have him scout his many activities for kids he may meet up with outside of their shared activity. It seems unusual for a child to have great friends at school whom s/he doesn't want to see outside of school... even turning down a birthday party. Have you spoken with him about loneliness, using an expanded emotional vocabulary to attempt to refine/pinpoint his feelings and learn what changes he believes might improve the situation? Based on statements in your post, is it possible that his "loneliness" stems from a sense of competition at home for your time... sibling rivalry?

While helping to meet your child's needs for appropriate academic challenge and intellectual peers, it may also be wise to manage your child's expectations that it is rare in life for a person to have all of their needs met. This gap provides the opportunity to develop grit, become resilient, engage in positive self-talk including planning and creative imagination, etc.

Regardless of whether a person is pleased with their current circumstances, it is important to develop self-control. Understood.org is one source with tips and advice on developing impulse control.