My son is 4.5, his older sister is 6. For both of them, while I gave them lots of talks about being nice, and how to spot mean bad behavior, and they are extremely nice and they're hurt when other kids aren't, blah blah, I also always made sure the most important thing was to blow this behavior off, tell the kid to quit being mean, move on, whatever. Unless there is very serious aggressive danger going on, I do not interfere. If one of them comes to me saying "That kid did_____" (and lots of kids around here are way bratty) I usually say, "Wow, that's not very nice, tell him/her to quit it and stop playing with them if you want" or "ignore them" etc. I've even been known to give it the "Handle it yourself, Sweetie, I don't need to hear it, tell them to quit it and just go play with someone else if they're being mean." It seems harsh, but after hundreds of times in parks etc, you just can't keep getting sucked in. My daughter had a bratty girl in her K4 class who I just told her to steer clear of. My daughter still played with her, but she didn't complain after a while because she knew I'd just tell her not to play with her. She would still tell me what the girl was doing, but more of a "can you believe it?" sharing way.
If the other kid is really being bad the school should be handling it much more effectively. If he's not being all that bad and they just keep trying to separate the "magnets" you should tell your son be less sensitive about it if he's going to keep playing with the kid. My son would grasp that at 4.5. He's had some trouble with kids in some classes and ends up playing with them just fine when reporting their behavior gets him nowhere.
Both my kids will also yell at kids to back off and have permission to fight back (which my son has only had to do once). Yelling nips the other kid's behavior most of the time. Brats like easy targets. I'd have your son yell at the kid and be tougher with him. Schools can't really be relied on to discipline kids these days.