Despite the fact that we spend nearly half our waking hours thinking about something other than what we’re doing, we’re actually happier when we focus on what’s happening in the moment. The way we direct our brains can help us manage pain, as well. And new findings suggest that spending time in a focused state may even increase gray matter, boosting areas of the brain involved in mental sharpness.

Harvard researchers noted the happiness factor last November, when they enlisted 2,250 study participants to record their thoughts and feelings immediately after being buzzed several times a day on their iPhones.

The study, published in the journal Science, found that the human mind wanders during virtually every activity — especially boring ones like driving in traffic or taking a shower — and that even when we reminisce about a joyous occasion, we feel no better than when we pay attention to those dish suds. When our thoughts turn to unpleasant or even neutral topics, like picking up the dry cleaning, the suds win out.

To help us plan for danger and learn from the past, the human brain’s default mode of operation evolved to be one of contemplation, brain researchers have shown. In order to be truly present in the moment, we have to make a concerted effort, a practice called mindfulness.

Based on 2,500-year-old Buddhist principles, mindfulness programs in the West are largely secularized and often involve using meditation to help people become more attentive to moment-by-moment sensations, like frigid wind across the T tracks or fingernails scratching on a blackboard, without judging them. While one of the first mindfulness stress-reduction classes began at the University of Massachusetts back in 1979, the practice has spread in recent years to virtually every realm of medicine, to help patients better manage chronic pain, depression, even overeating. A December study published in the Archives of General Psychiatry found that mindfulness therapy can be as effective as remaining on antidepressants to prevent a relapse of depression.

The latest evidence suggests that the practice of paying attention leads to anatomical changes in the brain. Healthy volunteers given MRI scans both before and after they attended weekly mindfulness classes for eight weeks experienced a 1 to 3 percent increase in their brain’s gray matter in particular areas responsible for learning, memory, and emotional regulation, according to a Massachusetts General Hospital study published last week in the journal Psychiatry Research. Two years earlier, the same researchers found that mindfulness training led to a decrease in gray matter in the brain’s amygdala, the area of the brain that perceives stress.

We don’t yet know what these brain changes mean,’’ points out study coauthor Sara Lazar, a neuroscientist at Massachusetts General Hospital, “but the part of the brain that grew a little involves perspective taking — seeing other people’s point of view and also the big picture.’’ That’s a central tenet in mindfulness: allowing yourself to be open to new experiences. “It’s all about adopting a receptive attitude: paying attention to how things are rather than how you want them to be,’’ says Ronald Siegel, an assistant clinical professor of psychology at Harvard Medical School and author of “The Mindfulness Solution.’’

After learning to practice mindfulness years ago, Siegel says he no longer walks without noticing the movement of his body. “Walk slowly and bring the full attention to the sensations of your feet lifting, moving forward, and stepping,’’ he says while inching forward on a brick sidewalk in Cambridge on a chilly January afternoon. “Of course, thoughts will enter your mind, but the idea is to step out of the thought stream and come to the actual sensations of life.’’

Tim Blackburn, a patient of Siegel’s from Jamaica Plain, found that learning to walk mindfully helped him overcome prolonged back pain that forced him to give up running 10 years ago. “I described my pain as I walked — how it went from my thigh to my knee to my shin — and it really helped me be present with the pain instead of clenching against it, thinking that it would never go away.’’ The walks led to painful 200-yard jogs and within two months, without taking medications, the now-54-year-old graphic designer was back to running five miles, eventually pain-free.

Now meditating weekly at the Cambridge Insight Meditation Center and attending annual silent meditation retreats, Blackburn says learning mindfulness helped him manage far more than his physical discomfort: “Sitting with my own thoughts and emotions made me more patient and compassionate with other people; it improved my relationships.’’

Mindfulness training can be learned on its own in, say, the eight-week University of Massachusetts Medical Center program (which costs $450 to $600, based on financial need) — the one Lazar and her colleagues studied — or woven into other stress-reduction programs like the $400 eight-week relaxation response resiliency program at Massachusetts General Hospital, which aims to benefit anyone suffering not only from headaches, anxiety-related conditions, and sleep problems, but also autoimmune disorders, asthma, and allergies.

“It includes mindfulness, but also visual imagery techniques, exercise, and a change in diet,’’ says Peg Baim, a nurse practitioner who serves as clinical director of the resiliency program. She says she went through the program herself years ago to help her manage her panic disorder and Graves’ disease, an autoimmune disorder. “I was a hyper-responder with an over-reactive stress response,’’ she explains. “Meditation helped me better regulate how my body responded to pain and emotional stress.’’

At Boston Medical Center’s nutrition and weight management class, Mitali Shah, a registered dietician, emphasizes the importance of mindful eating to control weight and improve weight-related conditions like diabetes and heart disease. “We make about 200 uncontrolled food decisions in a day, where we don’t think about what we’re actually eating or drinking,’’ she tells a group of seven overweight patients at their weekly session in January. She extols them to eat only when they’re hungry, maintain set meal and snack times without distractions like TV or phone calls, and consume small portions every two or three hours. “If the thought of food makes you want to eat,’’ Shah points out, “that’s appetite, not hunger.’’

After rating their current state of hunger on a scale of 1 — beyond starving — to 10 — painfully stuffed — the group confronts a single raisin. “Look at it, smell it, now put it in your mouth, but don’t chew yet,’’ orders the trim, well-coiffed Shah. “Close your eyes and just focus on the raisin. Notice the texture, the temperature, and the taste. We tend to overeat when we don’t focus on our food.’’

Margarita Lebron, a 53-year-old participant from Dorchester, says the exercise made her a believer: “For the first time, I got the taste of a raisin. Usually I just pop them in and don’t put any mind to the flavor. But this time I enjoyed eating just one.’’ Overweight most of her life, she decided last month to take steps to change her eating habits — her goal is to lose 50 pounds — after her doctor told her she was on the borderline of diabetes. “It’s like a new beginning; hopefully I’m on the right path.’’

Mindful-eating exercise

Take a single raisin in your hand — or substitute a nut or Hershey’s Kiss — and examine its texture, color and patterns. Where is it shiny and where is it dull? Observe whether it’s soft or hard, smooth or rough. Bring it to your nose and smell it. Notice your feelings as you smell: pleasant, unpleasant, or neutral. Next place the raisin on your tongue and let it sit there for a moment. Use your tongue to explore the raisin and notice how its touch is different from the touch of your fingers. Position the raisin between your teeth and bite down, feeling the squishy softness. Notice whatever tastes and feelings arise as you chew the raisin. Stay with the experience of tasting and chewing the raisin. Continue chewing until it falls apart in your mouth and then swallow, focusing on the movement of your digestive muscles. Take a moment to notice the new feeling of emptiness in your mouth and any residual taste of the raisin. D.K.

Mindful-walking exercise

This is best performed walking very slowly, so find a quiet spot, either indoors or out, where you won’t feel self-conscious. Carefully lift one foot and leg, and notice the sensation of lifting in terms of your balance and movement. Gradually move your foot through space, noticing how your muscles feel as they move. Place your foot back on the ground and notice any sensations that arise as your foot makes contact. Now move the other foot, lifting it slowly, pushing it forward, and placing it back down. You may notice that the slower pace throws your balance off slightly, so experiment at a pace that works for you. Continue to walk until you reach the end of the path, whether a street block or a hallway. Pause for a moment and notice the sensation of standing still: the air, the sounds, the colors surrounding you. Once you feel fully aware of the moment, turn around and walk slowly back. D.K.

Breath awareness meditation

One popular form of mindfulness meditation focuses on the breath. Sit comfortably on a chair or meditation cushion in a straight posture. Imagine that a string is attached from your head to the ceiling, lengthening your spine. Close your eyes and breathe naturally, focusing on the breath as it enters and exits your lungs. As you observe the breath, note the rising and falling sensations of your belly; try to follow the cycle of the breath: inhalation, exhalation, back to inhalation. Don’t try to control the speed of your breathing. This is simply an observation exercise. Distracting thoughts will come into your head but simply acknowledge them, without judgment, and bring your attention back to your breathing. Continue the practice for 20 minutes to get the full effects of the meditation. D.K.