Avoid food triggers. To put an end to diarrhea, steer clear of foods and drinks containing caffeine and lots of sugar, as well as sugar substitutes and fried or fatty foods. Also take a break from high-fiber foods, spicy foods, dairy products, and foods known to cause gas, such as beans, broccoli, and cabbage.