I'm allergic to many environmental and food things. This does sound like an allergic reaction. I'd also say that its quite likely a reaction to the bug spray tho it could be reaction to the pistachio. Nut allergies are common. The bug spray companies say to not expose yoursel, your children or animals to the spray. The idea is to quickly spray the rooms and leave for a period of time. Then to air the rooms out before staying in them.
If he is not having difficulty breathing then give him an antihistamine. If he's having even minor difficulty breathing take him to the ER. I suggest that you take him to see the pediatrician tomorrow if he's still itching. He can have higher than recommended doses of an antihistamine under a doctors supervision.
If you only have adult size anti-histamine tablets that are not time release you can cut the the tablet.. If it's liquid like a cough syrup give him the dose on the bottle. If you're not familiar with anti-histamines you can call the ER and talk with the advice nurse. Talking with her might be a good idea anyway.
Both I and my granddaughter have this sort of reaction every once in awhile. The allergist has told us to give her a child size dose of Benedryl and if that hasn't stopped the itching in 15-30 minutes to give her up to 2 more doses, one at a time. I've never had to give her more than a single adult sized dose.
I know from experience that scratching itchy fingers does cause them to swell, while scratching the body when it itches does not, tho it can break the skin and cause more itchiness. A cool bath with oatmeal in the water may help relieve the itchiness.
If he's asleep and not scratching and is breathing normally, I would not wake him up. If this is an allergic reaction and not a reaction to the bug spray he should feel much better tomorrow. But if he's not sleeping well then a trip to the ER may be in order. I'd call the advice nurse first.