Bill's response was spot-on...It's normal, hormonal behavior, and is most-likely going to continue to get worse and worse as he approaches puberty, which for a B&G Macaw is usually around 3-4 years old, although some start younger than 3 years, and I'd suspect your Macaw is likely going to hit puberty earlier than 3 years old based on how hormonal he already is at 2 years old. So it will continue to get worse, but there are things you can do to lessen the hormones, as Bill already mentioned...
#1.) Avoid all warm and/or mushy foods.
#2.) Make sure he does not have access to any fabric/cloth, like towels, blankets, etc. that he can readily get underneath; make sure he never has anything in his cage or around him that could be used as "nesting" material, such as bedding, wood chips, etc.; make sure there is nothing in his cage like any type of "Happy Huts", tents, hammocks, boxes that he can get inside or underneath, etc.
#3.) Make sure that when he's out of his cage that he cannot get underneath of any furniture or inside any cabinets, boxes, or any small, dark places.
#4.) Decrease his daylight hours and increase his amount of restful sleep...This is the big one, as Bill mentioned, and this time of year it's extremely important that you try your best to put him on a "Natural Light Schedule". This is easier to do in the spring and summer because we have longer days, but it's likely that his hormones going out of control are due to just that, not being on anything close to a "Natural Light Schedule". In the wild, birds awaken with the sunrise and watch the sunrise, and they also watch the sunset and go to sleep with the sunset, regardless of whether the sun sets at 5:00 p.m. or at 9:00 p.m. That's why you can hear wild birds outside as long as the sun is up, but you stop hearing them as soon as it's dark. This "Natural Sunlight Schedule" keeps their hormones on a very normal, yearly schedule, which is why wild birds have a very regular "breeding-season" schedule, while captive birds breed all year round and there's no "schedule" at all...So as Bill already suggested, putting him to bed much earlier so that he can get a good 13-14 hours of sleep, and then gradually decreasing his hours of sleep and increasing his daylight hours according to the sunrise and sunset, and making sure his cage or wherever he sleeps allows him to visibly see the sunrise and sunset, at least by the light changing in the room he's in. So making sure he sleeps in a room with a window that will allow enough light to come-in to the room (even with blinds/curtains shut) so that he will awaken with the sunrise every morning, and then trying your best to get him to bed as early as you can, and then as the months go by he will naturally, on his own, wake up earlier as the sunrise is earlier, and go to bed later, as the sunset is later. The more natural his daily light-schedule is, the more regular his hormone-cycles will be.
#5.) Get rid of any artificial lighting that you may have on him/over him/in his room...Not only do artificial "bird lights" or UVB lights usually do more harm than good, but they also encourage hormonal behavior, especially if they are being used this time of the year to "lengthen his daylight hours"...I keep seeing people saying that they are doing just this, using artificial "bird lights" or UVB lights to "lengthen their bird's days", but all this does is cause their hormones to go out of control, as it totally goes against their natural light schedule.
#6.) Lower the amount of protein and carbs/sugar that he is eating. The more energy his body has, the more hormone-production he will have. So feeding him less pellets/seed-mix/nuts/people food and feeding him more fresh veggies and dark, leafy greens this time of year is a must.
Obviously limit petting him anywhere but on his head/face/neck and that's it...
*****Very, very important is that you NEVER punish him for being hormonal!!! Bill already touched on this and he was very wise to do so, because this is not at all your bird's fault!!! Macaws are extremely intelligent and they use logic and reasoning...And if you "give him a time-out" whenever he becomes hormonal, but he knows that he gets time-outs when he does something bad like biting, this often causes HUGE psychological and behavioral issues because they don't know what they are doing that is wrong, and they don't know how to stop it (because they can't stop it!). So you cannot use the normal methods that use with him when he purposely does something bad/wrong to try to "correct" his hormonal behavior. As you've already found out, it won't help to "correct" his behavior one bit because it's not a behavior that he has any control over at all, and more-importantly hormonal behavior with their "flockmates"
or their main "mate" is completely and totally natural to them and is what they naturally do. In addition to not using "time-outs" or other punishments when he becomes hormonal, you also should never, ever take away any "Positive Reinforcements" from him because he's hormonal...Now I don't mean that you ever want to reward his hormonal behavior, obviously you don't ever want to do that either. However, if he does something that you would normally reward him for doing but you refuse to reward him for it because he's been hormonal that day, this too will only confuse him, frustrate him, and cause him to start having issues in his normal, daily behavior as well.
The best thing you can do whenever he becomes hormonal with you/starts regurgitating for you/tries to masturbate on you, etc. (if he hasn't already done this, don't be surprised when he does) is to make sure you DON'T ever yell at him, scold him, or say anything at all negative to him, but rather simply put him down on one of his stands or on top of his cage (NOT INSIDE OF HIS CAGE!, as his cage should not ever be used as a negative thing or a place to go when he's "bad"), wherever it is he hangs out regularly, and then walk away from him for 5 minutes and let him cool down...Then go back to him and let him step-up, and just act normally with him like nothing happened, but if he immediately starts being hormonal again with you, put him right back down on his stand or on top of his cage without saying anything, and just walk away again for another 5 minutes...Continue to do this until he steps-up for you and is able to be with you without be hormonal...And if he's okay for 20 minutes or an hour or 2 hours or however long and then he starts being hormonal again, whenever that might be, just take him back to his stand or back on top of his cage and walk away again for 5 minutes without saying anything...That way he will have time to calm down and settle himself, and while he'll eventually get the point that if he's going to be hormonal that's fine, but he's not going to be hormonal on you or to you, he will also not be upset or feel like he's being punished or like he's in-trouble for it; he'll learn that it's okay if he wants to be hormonal, but if he's going to be hormonal, he's going to do it by himself...