Hello, Marie!
I think the pain gate theory is quite interesting. The theory sounds logical to me, so I believe it can partly explain, why for example the positive energy around us and a pleasant atmosphere can relieve the pain. I believe the distraction that you mentioned is playing a key role in the mechanism of decreasing the pain. When your brain is busy with processing the emotions created by moments of joy (for example when you see someone you just helped being so happy), or by the beautiful environment (when walking in the nature), or when there are a plenty of other positive distractions, such as singing, music, or movements of your body (for example when dancing or playing basketball), the impulses coming from the pain receptors may either be blocked at the gates (that are often called synapses), or more commonly they may reach the brain, but your positive feelings beat the negative feelings caused by the pain.