Dr. Theodore M. Bayless, whose discoveries helped bring relief to lactose- and gluten-intolerant patients and others coping with the effects of intestinal disorders, died on Feb. 10 in Towson, Md. He was 87.

The cause was cancer, his son Neal said.

Studies by Dr. Bayless, who taught, conducted research and cared for patients at Johns Hopkins University School of Medicine for a half-century, helped in the development of treatments for acute diarrheal diseases and for inflammatory bowel diseases, including ulcerative colitis and Crohn’s disease.

“While still a young investigator, he made the landmark discovery of the role of lactase deficiency (a genetic defect in the intestinal enzyme that digests milk sugar) in the adverse reactions to milk experienced by hundreds of millions of people all around the globe,” Prof. David Sachar, a friend and colleague and emeritus chief of gastroenterology at the Icahn School of Medicine at Mount Sinai in New York, said in an email.

He added, “His insights into this problem laid the foundations of the lactose-neutralization techniques (such as in Lactaid and many other products) that have revolutionized the dairy industry worldwide.”

In 1987, Dr. Bayless received the Franklin Institute’s Corson Award for his research into the genetics behind lactase deficiency. That research resulted in the development of commercial products for people whose bodies rejected milk.

His studies also demystified the mechanisms behind celiac disease, or gluten intolerance; provided insight into how genetics and family history lead to the recurrence of inflammatory bowel disease; and distinguished the symptoms of inflammatory bowel disease and irritable bowel syndrome, which may require different treatment.

He also found that children whose growth was suppressed by inflammatory bowel disease could resume normal growth through aggressive treatment.

Theodore Morris Bayless was born on April 14, 1931, in Atlantic City, the son of David and Fanny (Halpern) Bayless. He worked behind the lunch counter at his father’s pharmacy and sometimes accompanied his uncle, a doctor, on house calls.

He graduated from Bucknell University in Lewisburg, Pa., in 1954, the same year he married his classmate, Janet (known as Jaye) Nides. She survives him. In addition to his son Neal, he is also survived by two other sons, Jeffrey and Andrew, and four grandchildren. He lived in Baltimore.

Dr. Bayless earned his medical degree from Chicago Medical School in 1957 and completed his internship and residency in New York at Memorial Sloan Kettering Cancer Center and what was then the Cornell Division of Bellevue Hospital.

He joined the faculty of Johns Hopkins in 1964, becoming a professor of medicine in the division of gastroenterology and hepatology. He was director emeritus of the Meyerhoff Inflammatory Bowel Disease Center.

Much of Dr. Bayless’s research focused on ulcerative colitis and Crohn’s disease, which inflame the bowel and can cause repeated and potentially fatal attacks of diarrhea, constipation, abdominal pain, loss of appetite and weight. Each disease can also lead to arthritis, liver damage, skin lesions, eye damage and painful cankerlike sores in the mouth.

Inflammatory bowel disease can produce bleeding and tears in the bowel that can lead to peritonitis and increase the risk of colon cancer. Other complications often require surgery. One of them, toxic megacolon, in which the walls of the bowel are stretched to the point of tearing, is potentially fatal.