Relaxation
This technique is about trying to calm ourselves down until the urge subsides.
Take a breather. Take a few deep breaths, inhaling and exhaling slowly. Slow down your physical cravings and your runaway thinking. Relaxation will get you through a surprising number of potential slips.
—Changeology
Sit back, breathe easy, let your muscles and mind go for a while, and tell yourself to be calm.
—Changing for Good
The Candeo Program suggests a variation of this called Gratitude Breathing to help specifically with sexual thoughts.
"When you feel sexual thoughts or urges start to come onto the stage of your mind, either during scheduled practice or in real life, immediately begin gratitude breathing."
In The Porn Trap, author W. Maltz provides additional info about how relaxation can help:
Thinking about using porn can trigger certain physiological reactions, such as changes in heart rate, blood pressure, genital blood flow, and pupil dilation... In addition, anticipating using porn can trigger the release of dopamine and other pleasure-related chemicals in the brain... This is why it is so important to figure out how to calm yourself, both physiologically and emotionally, once your sexual energy has become activated.
This book then gives some practical suggestions of how to relax with breathing exercises. Here's another technique from the same book:
Another helpful approach is to massage the outer area of your ears, a spot that can induce relaxation and calm. Massaging your feet can also quiet your agitated mind and body by helping move your attention and energy away from sexual excitation and toward feeling good in a non-sexual way. Some people find that quiet prayer or meditation helps create feelings of calm and relaxation, while still others prefer burning off excess agitated energy through vigorous exercise, such as jogging, lifting weights, or riding a bike.
In Fortify, it's included as part of their STAR technique:
Take a few conscious breaths. This allows you to focus your attention in one place and settle your mind. If you can, close your eyes and notice the lungs fill up with air slowly, and then release... Brain scientists are discovering that something as simple as conscious breathing can help calm the body and mind, in part, by slowing or short-circuiting the chemical rush to the brain in a difficult moment.
SMART Recovery mentions this technique, but doesn't push it so much.
Torah Sources
Sefer Yesod Tzadik, writings of R' Shlomo of Zevil (p. 203):
עצה להרהורים רעים חס ושלום. ידוע על פי הטבע כי עיקר חיותו של האדם על ידי כלי הנשימה תמיד, וכל פעם הוא שואף רוח ואויר נקי ומוציא האויר שבקרבו, והארכת הכנסת האויר אינו שוה בכל אדם יש מי שמאריך ויש מקצר, והתחלפות והתחדשות המחשבות היא בין הפרקים, בין יציאות האויר החם לשאיפות האויר הזך, ואם נזהרים באותו הרגע לחשוב רק בקדושה אז נמשך המחשבה כל זמן שהרוח הישן מתאריך בקרבו, והרגילות בזה נעשה טבע שני והבא לטהר מסייעין לו. [1]
On page 204, he even mentions gratitude breathing!
אמר שהכיר יהודי אחד (כידוע דרכו לא לומר על עצמו) ששנה שלמה נהג שבכל פעם שהכניס נשימה הודה להקדוש ברוך הוא על זה וכן בכל פעם שהוציא נשימה.
This concept is also hinted to in Bereishis Raba:
ר' לוי בשם ר' חנינא אומר: על כל נשימה ונשימה שאדם נושם צריך לקלס לבוראו. מאי טעמא? "כל הנשמה תהלל י-ה" - כל הנשימה תהלל י-ה.
- ↑ In the footnote he interprets the posuk וקווי ה' יחליפו כח in the sense that breathing (יחליפו כח) can help those that seek kedusha (קווי השם): על ידי החלפת כח הנשימה ניתן חיות לקווי ה'.