OOH! I feel sorry for him! Our dog sadie did that once.(She is an outside dog) I dont know how to solve it but here are two reasons:
#1.Sometimes bad dog shampoo gives them allergic reactions.
#2. There is types of dog foods that do that too.

Once again, Im sorry to hear that your dog is sick.
See U ! G2g!
-Shadowie Fury