Forget names, numbers, and words? Can’t remember what you were looking for? Don’t worry: Despite occasional glitches, your brain may actually be at its peak. Here’s how to make it even sharper.

You eat well, rarely veg out in front of the television, and never shy away from a mental challenge. (Six-letter word for a group of performers? Chorus!). So why do you find yourself staring into the fridge, unable to remember why you opened the door in the first place? Why do you sometimes mangle sentences and blank at a pivotal moment in a big work presentation?

Brain blips can be unnerving, but here’s the good news: They’re rarely the sign of a declining mind. Although your child-prodigy days are long gone, your brain is most likely to be at its best during midlife. That’s when your life experiences combine with decades’ worth of neural connections, resulting in peak intelligence and ability. “We may not learn or recall information quite as quickly as we did in our teens and 20s,” says Sandra Bond Chapman, Ph.D., the founder and chief director of the Center for BrainHealth at the University of Texas at Dallas. “But during our 30s, 40s, and 50s, we get better at what matters most: making decisions, synthesizing information, and coming up with big ideas.”

While your neurons can fire more slowly with age, more often than not stress and anxiety cause you to pathologize perfectly normal experiences, like forgetting an acquaintance’s name (again). “You probably pay attention to the few things that go wrong but don’t give your brain credit for the thousands of things it did right,” says Chapman.

Instead of focusing on the occasional lapse, concentrate on your daily habits, which play a major role in whether you operate optimally today—and whether you develop more serious problems, like dementia, later in life. When it comes to brain function, everyday behavior matters as much as—if not more than—your DNA. Here’s how to gain a mental edge.

1

Swap Old Standards for New Skills.

Photo by Cultura RM/Emely/Getty Images

Listening to Beethoven and doing sudoku will bolster your brain, right? Not exactly. While they’re certainly more stimulating than, say, zoning out to a Scandal marathon, new research suggests that a great way to boost brainpower is through learning—either mental, such as learning Spanish, or physical, like signing up for a CrossFit class.

According to a 2013 study from the University of Texas at Dallas, older adults who learned cognitively demanding activities, like quilting and digital photography, improved their memories. Those who listened to classical music, watched classic movies, or engaged in social activities, on the other hand, didn’t have the same gains.

2

Go Deep.

Take your learning to the next level by using your brain for what it does best: fusing existing and new information. “It will repay you by strengthening its complex neural networks,” says Chapman. For example, crack open a Hilary Mantel or Oliver Sacks book—and once you’ve finished it, spend some time writing a Goodreads review. You might be surprised at what you come up with while mulling it over again. Or reach for a pen and your journal: Studies show that writing by hand, rather than typing, improves information processing as well as the ability to remember what you’re writing about.

3

Tweak Your Diet.

A healthy brain diet looks a lot like a healthy body diet. Middle-aged and older adults who adhered to an eating plan called the Mediterranean-DASH Intervention for Neurodegenerative Delay (MIND) diet slowed cognitive decline—so much so that they scored the equivalent of 7½ years younger on cognitive tests after a year, according to a 2015 study from Rush University and the Harvard School of Public Health.

Like the Mediterranean diet, the MIND diet emphasizes nuts, beans, whole grains, poultry, and olive oil. But unlike the former plan, it calls for consuming leafy greens daily and at least two weekly servings of berries, as both are rich in brain-benefiting antioxidants.

4

Work Out—Especially When You Need to Be Extra Sharp.

It’s not news that exercise is good for your head. But working out on days when you have, say, a big presentation or test is key. Adults who did aerobic exercise regularly for four weeks—and exercised the morning that they took memory tests—scored higher than did regular exercisers who skipped their workout on test day, according to a 2012 study from Dartmouth College. Exercise’s stress-thwarting effects may be partially responsible: “Stress is toxic to the brain,” says Chapman. “It releases the hormone cortisol onto the hippocampus, where memories are stored.” That can make you momentarily forgetful and may weaken neural connections over time, increasing the odds of dementia.

5

Prioritize Sleep.

Short-change your sleep for just one night and it can take several nights of solid slumber to return to your sparkling, coherent self. “The brain processes information and consolidates ideas while you sleep,” says Chapman. ”And most of that appears to happen between the sixth and eighth hours.”

If you have trouble falling asleep, consult a doctor before turning to sleep aids. Prescription sleeping pills, although safe for occasional use, contain active ingredients that can slow down brain waves, making you feel groggy the next day. Over-the-counter (OTC) sleep medications are dicey, too. Most contain diphenhydramine, an ingredient that’s been linked to short-term cognitive impairment (i.e., that hungover feeling). Worse yet, people who used the OTC medications regularly for several years were at an increased risk of dementia and Alzheimer’s disease later in life, according to a 2015 study published in JAMA Internal Medicine. See a sleep specialist if you spend as much time counting sheep as you do dreaming.