Mercutio is a class clown. He will mock Romeo's views on love and do anything to make people laugh. Think of him as a Benvolio without a filter for his words. If you take a look at the Queen Mab speech in act one scene four, he is mocking Romeo's dream by saying a little fairy is responsible for dreams and that they don't mean anything.
He is a word master as well. He is the source of many puns in the play and is not afaid to use them. Romeo remarks to the nurse that Mercutio "A gentleman, nurse, that loves to hear himself talk; and will speak more in a minute than he will stand to in a month" (act II, scene iv, 140-42).
With a personality like this, it no wonder that his friends thought he was acting as he realized the seriousness of his wound from the fight in act three scene one. As he is dying, he uses another pun. He tells the group that if they "ask for me to-morrow, and you shall find me a grave man" (act III, scene i, 96-97). He needs to have the last word to point out to us the fact that it is the feud between the Montague and Capulet that have killed him.