Imaam Ibn Qudaamah Al-Maqdisee (rahimahullah) said:
Know that envy is a great disease of the hearts and the diseases of the hearts are not cured except with knowledge and action. The beneficial knowledge for curing envy is to know that in reality envy is harmful to you in (your) Religious and worldly affairs, and the envied one is neither harmed in his Religious nor worldly affairs; rather he is benefitted by it. Blessings do not cease from the person you envy. And even if you were not a believer in the resurrection, this (envy) would still have necessitated a realization–if you are sensible–to be mindful of envy due to the pain it contains in the heart alongside (having) no benefit. So how about when you know of its punishment in the afterlife.
And the clarification of our statement: “Indeed the envied one is neither harmed in his Religious nor worldly affairs, rather he is benefitted by it in his Religious and worldly affairs;”is because the blessings Allaah has decreed for him will continue until the end of the lifespan and there is no harm upon him in the hereafter (due to being envied) because he has not committed any sin in that; rather he is benefitted by it because he is someone receiving oppression from you, especially if the envy comes out through speech and action.
As for the benefit in the worldly life (i.e. the benefits of being envied), it is that the most important goal of the creation (i.e. the envious ones amongst mankind and Jinn) is (to witness) the grief of an enemy and there is no punishment greater than the envy you find yourself in. If you contemplate on what we have mentioned, you will know that you are indeed an enemy to yourself– a friend of your enemy (within yourself). Your likeness is nothing other than that of a person, who threw a stone at his enemy to kill him, but he could not harm him and the stone bounced back on his right eye and plucked it out. So his anger increased and he again threw a stone harder than the first one, but it bounced back on his other eye and plucked it out. So his rage increased and he threw a third stone, but it bounced back on his head and broke it, whilst his enemy is safe and laughing at him. This is a knowledge base cure (for envy). If a person reflects upon this, the inferno of envy will be extinguished from his heart.
As for beneficial action (to help cure envy), then it is to make binding upon oneself to destroy what envy commands one to do. So if it arouses him towards hatred and defamation of the one envied, then he should make it binding upon himself to praise and extol him. If it makes him arrogant, then he should make it binding upon himself to be humble towards him (i.e. the one envied); and if it makes him block favours from reaching him, then he should make it binding upon himself to increase in giving him favours. And there were a group of the Salaf who whenever it reached them that a person backbit them, they would give him (i.e. the back bitter) a gift.
These are very beneficial remedies for envy….
[For further details, see ‘Mukhtasar Minhaajil Qaasideen’ page: 200-201 with the Takhreej of Imaam Albaanee (rahimahullah). Abridged and slightly paraphrased]