I've been going through this a little lately with my 5.5 y/o son. We spend a lot of time with another family that has a 3.5 y/o daughter and she and DS1 play wonderfully together...most of the time. She's very taken with him and wants to be right by his side constantly. He sometimes would like a little space. Last week he was saying things like "I don't want to be her friend any more" and "make her go away".
I don't force him to play with her. He wants space and that needs to be respected. Any time a child says something like that to/about another child, they're trying to express some feeling/need. I see this as a call to help him express that need in a different way, and to help him to meet that need.
"You would like to spend some time by yourself right now."
"You're not feeling friendly toward 'Lily' right now."
"You would like to do something by yourself."
"When she follows you all over the playground, you feel frustrated and crowded."
He told me that he didn't want to go to a day camp session because she would be there and he was tired of her tagging along with him all the time. I thought maybe he could ask the teachers for help but didn't want to say "ask the teachers to make her go away" - not nice! Instead I said "maybe you could ask a teacher to help her find something else to do, so that you each have your own thing to do."
I am also trying to be sensitive about his need to have a little bit more space within his relationship with her by dialing down the amount of time I spend with her parents if I notice that he needs some time apart. Sometimes we do need a break from people, even our friends!
Childhood is long and adult social skills take years and years to slowly emerge! We can help this process by validating our kids' feelings, modeling socially appropriate things to say (without straight-out correcting them - just rephrase), and also modeling that self-care is OK (e.g., alone time).