I had a recent conversation with a friend who was feeling inadequate compared with other people. He felt bad about himself because he thought others were smarter, more attractive, more popular, etc. The following is adapted from my reply. These thoughts help me a lot as well when I feel envy.
Philosophical views dissolving personal identity help here as well.
We're all in this together. Isn't it marvelous that there are so many wonderful, talented people in the world? You're one of them, and they are others. When people around us are joyful, healthy, productive, and doing good work, this is a beautiful thing. We can be proud of one another, happy for each other's successes, and inspired to realize that we're each doing our best to reduce suffering in the world. What more could we ask for? At the end of the day, doesn't it feel better to be partners and friends than to feel superior to other people?
Philosophical views dissolving personal identity help here as well.