Many of the explanations offered for the sharp pain runners feel during hard breathing, usually on the right side, involve muscle stress or spasms in or near the diaphragm.
Because the muscle stress is probably caused by a rhythmic, repetitive activity, the solution is to develop techniques to break up that stressful rhythm. Runners could try changing their breathing patterns by breathing slower and deeper and forcefully exhaling through pursed lips.
Other suggestions involve changing running position by leaning forward, backward, or sideways, stretching before running, having the stomach as empty as possible before running, and changing the foot one lands on when exhaling.
A more direct explanation is that the rhythm of running causes bouncing of the liver, stretching the ligaments that link liver and diaphragm.
In this case, the suggestion is to stop running and use a hand to press the liver up against the diaphragm until the pain ends.