I've had similar issues myself with my own son when he was that age. Here are somethings that you may want to consider:
**Probiotics to help balance out the bad flora and good flora in your sons intestinal track.
**Cutting out dairy (milk, yogurt, cheese) completely from your son's diet for at least 2 weeks. Also check labels on the foods that you are giving your son, such as bread and pasta sauce, to see if it says anything like "lactose" or "casein" which are basically dairy. You can give him goat milk products instead (more easily digested than cow's milk) or opt for almond milk, hemp milk or rice milk products.
**Cutting out wheat products from your childs diet completely for a 4-week trial period. A lot more kids now days have food intolerance issues with wheat (gluten) and diary. If a child has a gluten intollerance issue, then it can cause digestive issues to the point where consuming this ingredient can harm the digestive track.
**Try giving your child Nordic Naturals 3-6-9 Jr. (split open the capsule and add to apple sauce) supplement twice a day. Omega 3 is like the talisman for good health for everyone. It helps your body in so many ways but it also helps heal your digestive track and keep it healthy but it takes about 6-months to see the full effects of it when you have issues like dirrhea and constiptation (the two issues go hand sometimes). I specify the Nordic Naturals brand because my son and I have been taking it for years and I know that it is really pure and mercury-free (very important!).
**If you can, take your son to go see a Osteopath (OD). They are doctors who specialize in whole body care and wellness instead of treating isolated symptoms on an as needed basis. You may get some better info and support if you go that route.
Hope this helps. Best of luck to you and your son.