The best advice is probably not to pet him. His mindset is probably changing and when that happens the hens are “his” and pets are probably perceived as threats. I had to start treating mine this way once he grew out of baby stage and he has been a great boy 5+ years now.
Also keeping cool today was one of my neighbor’s hens, who found a nice shady spot on a paver and put it in park for a good bit:
During which, my bantam rooster made enthusiastic overtures, but she effectively shut down whatever he had in mind by ignoring all his attempts at light conversation.