What do you eat before it happens? If you eat things like broccoli, coliflower, beans, squash, celery, sometimes non lactoise free products, sometimes flour products, white bread, etc this can cause your problem. I have the same problem. If I eat any of these because of their high amounts of fiber and because I am lactose intolerant I eventually get also the almost 9-month-look alike pregnant belly with pain. specially with squash and celery which for me have been the worse. Sometimes carrots too. Try checking if this works. Sometimes this problem is triggered by a huge stressful situation. It could be Stress Colitis. If it is caused by something else, do consult a doctor to discard something more serious.
Good Luck
Have you seen your dr for this? Is it IBS? Are you constipated? there are many questions that need to be answered before I would even know what to attempt to recommend. But if you have not had this checked out, I would see a dr. Keep searching.