There is actually no effective way to avoid pain in relationships. There is really no path that will lead us to a very smooth sailing relationship even if how much we love to have one. We can never really hide much more that we can never run. That is actually one cold and hard truth about relationships. Pain coexists with love and both of them share one common goal of making the relationship a healthy one. However, there are means to actually lessen the effect of it on each individual and it is just a matter of being cognizant even if we are not adept with relationships.
The first thing would be to learn to expect that pain will come knocking at the door of your relationship sooner or later and understand that everybody undergoes the same pain although it may not be the same intensity. If you expect it to come, it will be easier to deal with it because you already have pondered a lot about what you can do to lessen the pain as it comes. Expecting the arrival of pain is like expecting a visitor to come to your house. You will need to prepare, bring out the best utensils and cook the best dish you could ever muster. Because of you expecting it to come, you were able to know how to prepare.
The next best thing would be to allow communication between the two of you. The kind of communication that is always in open line and that one can pour his or her self and the intense feeling inside ones heart. If you pour it out in the open, the easier it will be to deal with that certain feeling without really having to compromise your ego or your esteem. You remain as you are in front of the person you love but you are feeling less pain if maintain that communication. There is really nothing that can be achieved if you sulk at one corner and shutting your heart from pain because you are only repressing it and not healing. In time, it will resurface and you will only be left consumed by its rage.
Another one that you should be remembering is to allow the person become part of your pain even if he or she is the one who is caused it, it would be a great feeling if he or she shares the burden because in my own point of view, the only one who can actually help mend your pain is exactly the one who causes it. I have always believed that this is the case because the more you fight the person you love the deeper the wound will seep through.
It may not be really enough to eradicate the pain. However, our goal is not to make the pain go away but to lessen its killing effect on us and ease the burden that will somehow affect our relationships to those that we love. I honestly do not believe in the saying that time will heal the wounds of the past anyway.