Coffee has long been part of many people’s morning ritual, and research indicates that drinking even just one or two cups per day may provide health benefits ranging from reduced risk of depression and heart disease, to protection from cancer. Studies have linked a moderate coffee intake with decreased risks for diseases affecting billions of people around the globe.

But moderation is key. A recent Mayo Clinic Proceedings study concluded that individuals consuming more than 28 cups a week, or approximately four 8-ounce glasses daily for adults, had a significantly increased mortality risk compared with those drinking less. The 10-year research project followed roughly 40,000 participants; its findings were strongest among younger individuals.

Researchers studied both regular and decaf coffee consumption. Additionally, they considered other variables that may impact health outcomes, including smoking and physical activity levels. After accounting for these factors, the researchers discovered that drinking more than 28 cups per week was associated with an increased risk of death from any cause as well as cardiovascular disease death; but that these risks weren’t altered depending on which kind was consumed — regular or decaf.

While caffeine itself offers some health advantages, including increased alertness and temporarily increased energy, coffee’s main health advantages come from polyphenols found in beans that have been linked with decreased risks for depression, stroke, cancer and heart disease as well as improved mental function and brain health.

Apart from consuming too much caffeine, the key to enjoying coffee optimally lies in selecting and preparing high-quality beans carefully. Aim for light roasts with small particle sizes for optimal polyphenol extraction; and only add small amounts of milk or non-dairy alternatives as sweeteners (milk is best); any unhealthy sweeteners like syrups and cookies could add significant calories and sugar content.

If you’re concerned about how much caffeine you’re consuming, try sticking to the 400 milligram daily caffeine limit recommended by the FDA – that should equate to two or three 12-ounce cups of coffee per day. Pregnant women and those with certain medical conditions should limit or avoid coffee entirely altogether.