I think that the dry dog food is partly to blame. Some dry dog foods contain a lot of corn or barley. I found that these dog foods made my dog gassy. He was arching his back and visibly uncomfortable.
I feed my dog a steady diet of evo mixed with real turkey, fish, or chicken. I also give him a little bit of spinach. He is regular and much healthier.
I would also have the anal glands drained.