I am not clear if you are riding in an arena where horses are being schooled, or if you are on a trail ride. In either case, you must make yourself be the most interesting thing in the world to your horse, so that he stops reacting to the other horses. It sounds like he forgets you are on his back in these situations. If this group is made up of friends, enlist their help. Ride single file at walk, then the first horse moves to the last position and everyone moves up one spot. After a minute or so, the front person moves to the end, everyone moves up, etc. Once you get the hang of this at the walk, do it a trot, and eventually canter. This works great on trail rides when a horse thinks he always has to be in front. If the group is not people you know, I would change direction and go the opposite way the other horse is, make a small circle, stop and back up – something to get his mind on you and off the other horse. Not a lot of room to explain it all here. Three things to check before you are allowed to punish a horse: 1) is he emotionally there? 2) Does he understand what you are asking? and 3) Can he physically do what you are asking? Figure out which one is missing. In your case, it’s the emotions taking over, so you need to work on getting his brain back in his head by asking him lots of “questions” – again, changes of direction, leg-yielding, lots of transitions, etc. Keep him guessing and he will pay more attention to you and less to his horsey friends. Not a lot of room in this forum to say much more. Good luck.