Researchers in Finland looked at nearly 400 children from their third trimester of pregnancy till their first 12 months of life. Parents filled out weekly diaries with information on their child's health and their exposure to dogs or cats.
It was found that those living with a pet were reported to have fewer weeks of a cough, cold, ear infection, or fever, and also to take fewer antibiotics than children who had no contact with a dog or cat.
The study, published in the medical journal Pediatrics, suggests that early contact with pets may strengthen a child's immune system to help protect against respiratory infections, the researchers said.
Homes with cats are healthier for babies, too, but not to the same extent as those with dogs, said study researcher Eija Bergroth of Kuopio University Hospital.
"The strongest effect was seen with dog contacts. We do not know why it was stronger than with cat contacts," Bergroth told WebMD.
"It might have something to do with dirt brought inside by the dogs, especially since the strongest protective effect was seen with children living in houses where dogs spent a lot of time outside," she said
Although it's not clear why living with a dog makes such a difference, it might have something to do with the dog itself as an animal, she added.
A time-honored theory, the hygiene hypothesis suggests that children's immune systems mature best when infants are exposed to germs in just the right amount. Too many germs are unhealthy, but so is a sterile, germ-free home.
The theory is now giving way to the microbiome hypothesis, said Prof Karen DeMuth of Atlanta's Emory University.
"The hypothesis is that early-life exposure to varieties of microbes lets them mix with the microbes in the gut and helps them keep the immune system from reacting against itself and causing autoimmune disease, or from reacting against stuff you should ignore and causing allergy," she added.
However, this is not a one-size-fits-all kind of thing, experts warned. Having a pet protects against infections and allergies, but that does not mean one should keep a dog with an asthmatic child in the hope that it might help, they said.
"This is always a hard question," Bergroth said. "But it is important for the child that its parents can live happily in the home without symptoms."