Many years ago, I was told to take Metamucil (which is an over the counter item and its' generic can be found in the pharmacy section of stores like Walmart) every day for irritable bowel syndrome. It is called a bulk-forming laxative, so it is supposed to be good both for bulk forming when you are having diarrhea and for constipation because of the fiber's laxative effects.
I also was prescribed Bentyl for a time- you may want to ask your doctor if that would be right for you or not. For gas, you might want to get some over the counter simethicone (such as Gas-X) and perhaps some Bean-O in case you indulge in eating gas-forming foods.
There are certain dietary changes you should make when you have irritable bowel & you might want to check with your doctor or dietician about those. One thing that can bother some people, for example, is the lactose found in cow's milk... it used to give me diarrhea. Also, you want to have as little stress as possible when you have irritable bowel, because stress can aggravate symptoms.
Do you mean irritable bowel syndrome?