So sorry to hear that your little guy is struggling with this.
I know it must be frustrating for you to have spent so much time and energy trying to find the cause of his problems and seemingly not making any progress.
It could be something like Irritable Bowel Syndrome - the symptoms of that can be brought on by diet, stress, etc.
I would second
momof3bostons recommendation of maybe trying a new food. Maybe a different food might help to settle his stomach.