(CNN) -- Two-year-old Ethan Wily had a cold recently, so at first it wasn't surprising that he started coughing last week after eating some pistachio gelato.

But he started coughing up mucus, and then gasping for air. His parents gave him an antihistamine, but it didn't stop the reaction. By the time the boy's parents brought him to their local hospital, he could barely breathe.

"His face was really swollen. He looked like an alien," said Ethan's father, Preston Wily of Lehi, Utah. "We didn't have any idea an allergy could be so bad."

He said the child had shown only a somewhat mild reaction to peanuts before this.

It seems like more and more children in the U.S. are developing food allergies, and there's data to back that up. The number of kids with food allergies went up 18 percent from 1997 to 2007, according to the U.S. Centers for Disease Control and Prevention. About 3 million children younger than 18 had a food or digestive allergy in 2007, the CDC said.

Scientists are still trying to figure out why food allergies seem to be on the rise, especially in industrialized countries such as the United States. Are children not getting exposed to enough bacteria? Should they eat common allergens such as nuts and shellfish at an earlier age?

A recent study in the Journal of Allergy and Clinical Immunology found that visits to the emergency room at Children's Hospital Boston for allergic reactions more than doubled from 2001 to 2006. Although this is just one hospital, the findings reflect a rise in food allergies seen in national reports, said Dr. Susan Rudders, lead author and pediatric allergist-immunologist in Providence, Rhode Island.

Researchers took a look at thousands of cases in the emergency department. They did not rely on the diagnosis given at that time, but made their own determination about whether an allergic reaction had occurred based on symptoms such as hives. That means the rise in reactions probably did not have to do with an increased awareness among doctors, Rudders said.

This also suggests that previous reported numbers of allergy-related hospital visits are underestimates, Rudders said. For all adults and children in the U.S., there are 30,000 ER visits because of food allergies each year. But that is based on a report that is about 10 years old, and this figure is likely higher now, Rudders said.

Doctors in other parts of the country have also noticed an increase in children coming in with severe food allergies. Dr. Ronald Ferdman at the Children's Hospital of Los Angeles said his hospital has seen a rise of these cases, based on anecdotal evidence.

Dr. Joseph Zorc at the Children's Hospital at Philadelphia cautioned that there may have been situational factors that influenced the Boston hospital's experience -- for example, if another hospital in the area stopped taking cases, resulting in more people at Children's Hospital Boston. But he agreed that food allergies are causing more significant reactions in U.S. emergency departments in general.

One theory is that the Western diet has made people more susceptible to developing allergies and other illnesses.

A study in Proceedings of the National Academy of Sciences compared the gut bacteria from 15 children in Florence, Italy, with gut bacteria in 14 children in a rural African village in Burkina Faso. They found that the variety of flora in these two groups was substantially different.

The children in the African village live in a community that produces its own food. The study authors say this is closer to how humans ate 10,000 years ago. Their diet is mostly vegetarian. By contrast, the local diet of European children contains more sugar, animal fat and calorie-dense foods. The study authors posit that these factors result in less biodiversity in the organisms found inside the gut of European children.

The decrease in richness of gut bacteria in Westerners may have something to do with the rise in allergies in industrialized countries, said Dr. Paolo Lionetti of the department of pediatrics at Meyer Children Hospital at the University of Florence. Sanitation measures and vaccines in the West may have controlled infectious disease, but they decreased exposure to a variety of bacteria may have opened the door to these other ailments.

"In a place where you can die [from] infectious diseases, but you don't get allergy, obesity, asthma, inflammatory bowel disease, autoimmune disease, the flora is different," Lionetti said.

This study only looked at a small number of children, but the findings support the widespread notion of the "hygiene hypothesis" -- the idea that cases of allergies are increasing in number and severity because children grow up in environments that are simply too clean.

"That our immune system is skewed away from fighting infections, and toward fight things that it's not supposed to be fighting, like things in the environment or foods -- that's one thing that people think may be in play," Rudders said.

Still, this is only speculation.

Another theory is that children need to get exposed to common allergens, such as nuts and shellfish, from a much earlier age, to avoid developing allergies. Some doctors have been recommending waiting until 2 or 3, but Ferdman at Children's Hospital Los Angeles is a proponent of giving kids nuts very early.

An oft-cited 2008 study in the Journal of Allergy and Clinical Immunology compared peanut allergies among Jewish children living in Israel and the United Kingdom. Peanut allergies were more common among the children in the U.K. than in Israel. This was associated with the fact that 69 percent of the Israeli children received peanuts by 9 months of age, compared with 10 percent of the infants in the U.K.

This pitfall, however, is that it was not a controlled experiment, and other factors may have influenced the allergies. More research needs to be done to support giving peanuts and other common allergens to infants. But according to Ferdman, more doctors are questioning recommendations to delay these foods.

These issues about when to introduce allergens are crucial for Preston Wily and his wife, Jen, who are expecting a second child next month. The parents are planning to wait on introducing nuts until their daughter is old enough to get tested for allergens, Preston said.

But hearing about recent research does make the father wonder whether delaying nuts could have influenced Ethan's allergies.

The boy isn't the only one in his peer group with allergies. Ethan goes to a nursery program at church where there's a wall of children's photos with each kid's personal list of food allergies. The teacher has been trained in how to use an epinephrine auto-injector in case of emergency.

Ethan's father knows now to administer an epinephrine injection as soon as the child begins to have a sign of anaphylaxis.

"There are a lot of kids here with allergies -- everywhere. It just seems more common now than when I was little," Wily said.

