While I'm away, readers give the advice.
On telling a sympathetic story that comes across as one upping • Pay attention at the moment you realize you have a comparable story. Because it is at that exact moment that you have stopped listening to the other person and are instead thinking about what you want to say: You are listening for your chance to jump in, and ignoring the other person.
So STOP thinking about your own story and go back to listening to the other person. Maybe ask for some elaboration, or continuation, or clarification. Encourage them to tell their story, and let them. What are they telling you? What happened, what did they bring from it? Shut up and listen. Listening is a harder skill than talking. Develop it.