Scientists found that these babies had a 19% lower risk than those who were breastfed for a shorter period or not at all.
These findings were made after scientists reviewed 18 different studies.
The researchers, at the University of Haifa in Israel, suggested more should be done to educate women on the health benefits of breastfeeding, while there should also be efforts to make it easier for women to do it in public.
A separate analysis of 15 studies found that being breastfed was associated with an 11% lower risk of childhood leukaemia, compared with never being breastfed.
Leukaemia is the most common cancer diagnosed in childhood and accounts for about 30% of all childhood cancers but little is known about its cause.
The amount of women breastfeeding in the UK is increasing, according to the Royal College of Paediatrics and Child Health (RCPCH), with 55% now breastfeeding at six weeks and 34% at six months, but younger mothers and those living in areas of higher deprivation are the least likely to breastfeed.
The research is published online in JAMA Pediatrics, with the authors suggesting the biological mechanisms of breast milk may explain their results.
They state breast milk contains immunologically active components and anti-inflammatory defence mechanisms that influence the development of an infant’s immune system.
“Health care professionals should be taught the potential health benefits of breastfeeding and given tools to assist mothers with breastfeeding, whether themselves or with referrals to others who can help," the authors said.
"The many potential preventive health benefits of breastfeeding should also be communicated openly to the general public, not only to mothers, so breastfeeding can be more socially accepted and facilitated."
Dr Colin Michie, chairman of the RCPCH's Nutrition Committee, welcomed the findings.
He said: "The benefits of breastfeeding to populations of children are well established. Breastfed babies are less likely to contract chest and ear infections, suffer from sickness and diarrhoea or become obese.
"Earlier this year, a study highlighted that breastfeeding was associated with better school performance, a higher IQ and higher incomes in later life.
"So this latest development is not only a very important discovery, but further adds weight to the benefits of breastfeeding."
Janet Fyle, professional policy advisor at the Royal College of Midwives, said: "This research underpins yet again why breastfeeding should be encouraged and supported. It is without doubt one of the most positive ways for a woman to give her newborn the best possible start in life.
“The important issue is to ensure that women have access to skilled advice and support to help them to initiate and sustain breastfeeding.
"The beneficial effects of breastfeeding last a lifetime. Given the increasing focus on public health, we should be doing all we can to encourage it. This includes investment in staff."