Hi, Welcome to JustAnswer. I am a licensed veterinarian and I'm here to help you. So sorry to hear about your dog's discomfort. Anal gland impaction can be so uncomfortable and can lead to anal gland abscessation. One common cause of anal gland problems is allergies, so benadryl may be of benefit and this is something you can give at home. The dose is 1 mg/ pound of body weight every 8 hours. If you have already been giving him an NSAID pain killer I would recommend continuing this. What medication have you been giving him?
I'm in Taiwan at the moment so the time here is 9:00 PM. Hopefully I'll hear from you before bedtime here. . .I'll keep checking.