It often does take a while for LOs to get used to cow's milk when they transition from formula. We were told to be watching for gas, some tummy pains and diarrhea - which was hard for us as those are the symptoms of milk allergy and DS had been diagnosed at 4 mos and on hypoallergenic formula! So, hard to know if it was still an allergy or just the normal transition!
Intolerance is not allergy, they are both different, and lactose intolerance is different than milk allergy. Intolerance is more of a digestive problem where the bowel has trouble in breaking down the proteins and continual exposure to the food causes intestinal damage. Allergy is an immune system reaction where the body thinks that food is a foreign/harmful substance and triggers a reaction against it. The difference is negligible as symptoms can be the same and treatment is the same - no milk or milk products - so the terminology tends to be used interchangeably.
Milk allergy/intolerance is a reaction to the milk proteins. Can't have any milk period - in the case of formula for LOs it needs to be a hypoallergenic formula, where the proteins are predigested and broken down. Lactose intolerance is different. Lactose intolerance is when the digestive system lacks lactase which is the enzyme that breaks down the sugar in milk (lactose). You can treat milk with lactase drops or take lactase tablets to prevent problems digesting the milk and thus still have the milk. True lactose intolerance is very rare in LOs but they can develop a temporary bout of it after a D&V bug very easily and it is quite common.
I would be very shocked if your LO developed a milk allergy or lactose intolerance at this age, although really, anything is possible with food intolerances and allergies! It could be him getting used to the cows milk, it could be the lactose in the milk or it could be a late-onset milk allergy. But, it could also be something else he has been eating in the day (foods like brocolli, cauliflower, cabbage, beans, etc all make my LO gassy in his sleep!) Or is it possible that he is waking due to a routine issue and because he is awake he is more aware of the passing gas and it is making him uncomfortable? My LO trumps all night long in his sleep and doesn't really notice but in the day when he is awake and needs to he is quite bothered by it...and I am sure that it is just that his system is relaxed at night and doing it's thing, kwim?