As endurance athletes, we train to perform for several hours over a great distance. We face long periods of time alone, where the finish can seem endless, each mile more painful than the one before. There are many opportunities to quit, and without coaches or trainers on the course, it’s often up to our own will to keep going.

It’s usually not the body that gives out first. It’s the mind.

Matt Fitzgerald explored this idea in his book, “How Bad Do You Want It?, where he argues that great performances begin from the mind.

“The training process increases an athlete’s physical capacity, but at the same time it changes her relationship with perception of effort,” Fitzgerald explains. “The fitter the athlete becomes, the easier it feels for her to swim, bike, run, or whatever … if the athlete’s physical capacity increased but her relationship with perception of effort did not change accordingly, her race times would not get any better because she would be psychologically unable to access that increased physical capacity.”

For those of us using Headspace, that’s a familiar concept. We do not focus on our thoughts but instead on our relationship to those thoughts. Positive or negative, thoughts come and go. We see them for what they are and then let them pass.

So too can this approach affect us as endurance athletes. There are good days and bad days. Sometimes we hit a zone where everything feels in sync and the miles fly. We revel in positive thinking. Other times we cannot bear the thought of another step, another pedal, another stroke. Our bodies are capable, but how do we convince the mind? Meditation—and its lessons—may provide some answers.

During the 2012 Western States 100 ultramarathon, Timothy Olson hit the wall about two-thirds of the way through the race. He drew upon his practice of meditation to focus on his breath, calm down, and listen to what his body required. He tuned out the negative thoughts. He got himself back on track and ultimately won the race.

What works for a pro can also work for us. Here are some strategies that may help you push through your own walls and stay focused on your goals:

1. Balance mental training with physical training

Success begins in the preparation phase. When outlining your training plans, consider mental training a key pillar, along with diet and physical training. By doing so, it forces us to commit to meditation and makes our mental training a resource for our physical training.

Once we start to feel pain, we can become fixated on it. If we do not have a strategy or technique to move past these obsessive thoughts, we can become trapped. Meditation gives us the techniques and strategies to help move forward.

2. Meditate before heading out

A recent study suggests that meditation and aerobic exercise together can prove effective against depression. The mental and physical efforts have a positive impact on the parts of the brain that control our focus on negative or unhappy thoughts. The researchers also acknowledged that being in a mindful state—focused on breathing and body awareness during workouts—increased the athlete’s enjoyment.

A happy athlete is a successful athlete. Happiness at the outset, and strategies for maintaining that happiness, could ward off the negative thoughts we experience during our long-distance training or races.

3. See the pain for what it is

We’re in the middle of a race, and suddenly that dreaded feeling hits where we’re out of gas. We try to reason with ourselves: ten more minutes and then break, five more minutes, one more minute.

The mind has already conceded defeat, counting down to giving up, regardless of how our bodies feel. In these moments, meditation can help us acknowledge our thoughts, without getting consumed by them. We can take stock of the situation. Often our bodies hold strength in reserve. We just need to allow ourselves to find it, despite our minds screaming, “No!”. We calm the mind, focus on breathing, see our thoughts for what they are, and move past them.

4. Incorporate visualization

Visualization can help distract the mind from the physical effort and prove a calming influence. I used this technique during an Ironman 70.3 race. During the run, I pictured my family waiting at the finish line. I focused on how it would feel to get there. I focused my mind on that image and allowed the feeling of happiness and accomplishment to swell. It helped me to get through the final four miles of the run.

By focusing intently on that image, there left no room for the negative, distracting thoughts that may have hobbled me.

5. Focus on fixing the relationship

How we approach our thoughts is the key. When we change the relationship of our mind to the challenge, we can set ourselves up for success. How often do we give in to our mind, stop training, only to realize how much more effort we had left in the tank?

Simply understanding the relationship between our mind and our ability to perform—and remaining mindful of that relationship before, during, and after our workouts—can help us push further and reach higher goals.

Change the relationship and break through the wall.

No sweat, right?

The author of this post is an editorial contributor to Headspace. These are their views, experiences and results and theirs alone. This contributor was paid for their writing.