I was having the same (different age range, early 30's) symptoms, and I was able to eliminate my problems by cutting out coffee entirely. I can still drink caffeinated tea without issue. When I first quit coffee, I cut out all spicy foods and beans. Now I eat spicy foods and beans occasionally without issue.
Naturally, the doctor that did my colonoscopy didn't recommend trying any of this, just wanted to slap me on some new drug that messes with the immune system, no thanks.