Mercutio is Romeo’s best friend — fast-talking, foul-mouthed, allergic to sentimentality. He isn’t a Capulet or a Montague. He’s kin to the Prince of Verona, which means he can sit in either house and tease anyone he likes. Shakespeare gives him the longest non-soliloquy speech in the play (the Queen Mab speech) and most of the play’s filthiest jokes. He is the friend you call when you want to be talked out of being dramatic.
What Mercutio wants is for Romeo to stop moping. He doesn’t take love seriously — neither Rosaline nor Juliet — and his teasing of Romeo’s puppy-eyed verses is half affection and half impatience. By Act 3 what he wants is even simpler: for Tybalt to back off. When Romeo refuses to fight Tybalt (because he’s just secretly married Tybalt’s cousin, though Mercutio doesn’t know that), Mercutio can’t bear the dishonour and draws his own sword.
Mercutio doesn’t change. The play kills him for it. His death — early, shocking, between his two best lines — is the hinge of the entire tragedy. Up to Act 3, Scene 1, Romeo and Juliet is a romantic comedy in the wrong key. After Mercutio dies cursing both houses, the play turns into something you can’t laugh at. He’s the canary, and his death is the warning that nobody hears in time.