Try to Be Understanding
It goes without saying that it's not right to judge a person till you have been or at least tried to be in their shoes. Your overly competitive friend probably has self-esteem issues that's stirring up this jealousy and competitiveness in them. This doesn't excuse their behavior but it does help you see where they are coming from and potentially help them.
Talk To Them
Sometimes your friends might not even know that they are being competitive. Try talking to them and let them know your feelings about the situation. Stage a kind of intervention where you calmly relate with them and give instances of their competitiveness (preferably with evidence or with a witness, who might also be a close friend), with the intention of helping them in any way you can.
Ensure You Keep Your Cool
As much as possible try not to lose your temper with them, even if your intervention fails and they end up defending themselves and their actions. Walk away from the scene if you have to. You have to remember that getting angry will not help the situation. Once you're calm, it'll be easier for you to figure out what next to do.
Recognize Their Good Qualities
Competitiveness is an obnoxious quality that has a way of overshadowing the good qualities that a person might have. Try not to let that be the case with your friend. Make an effort to recognize the good qualities that attracted you to the friend in the first place.
Be Supportive
You can try to be more supportive to your friend in an attempt to show that not everything is a race or competition. Sometimes you can just let them win, the key word here is 'sometimes'. Try acknowledging their accomplishments, give them the praise they desperately seek and you may find that their competitiveness wanes while they learn from the good behavior you have modeled for them to follow.
Find the Positive Side
Find ways to make your friend's competitiveness an asset to your friendship. Typically, competitive people are hard-working, are willing to make sacrifices, take on extra responsibilities and tend to get the job done. These are all useful qualities. Simply find ways to share a common goal with your friend, so their qualities and zeal can be used to your advantage.
Have Boundaries/Limits
You need to know when enough is enough, and more than that you need to be able to differentiate between a friend that's only competitive and one that's just plain envious of you. Most times, unfortunately the two go hand in hand. You should have a line that your friend, with all of his/her competitiveness, must not cross and you should be able to stick up for yourself when that line is crossed and shut the behaviour down. Remember, friendship is not by force and ending the friendship is an option if things start to escalate.