Lucio is Claudio's zany, bachelor pal.
Lucio has a wicked sense of humor, a big mouth, and a penchant for lying. (He spreads a rumor that Duke Vincentio likes hanging out with prostitutes and tells everyone that Angelo was "spawned" by a mermaid and urinates ice.) This outrageous and irreverent behavior provides some serious comic relief (and let's face it, we need a few laughs sprinkled throughout this dark play).
Yet, Lucio's behavior (which includes frequent visits to the city's illegal brothels) also gets him into to serious trouble because he talks trash about Duke Vincentio to the disguised Duke, who isn't as amused by Lucio as the audience is.
When Duke Vincentio punishes Lucio by ordering him to marry Kate Keepdown (the prostitute Lucio jilted after she gave birth to his child), Lucio also voices (rather loudly) the idea that marriage is a fate worse than death: "Marrying a punk, my lord, is pressing to death, / whipping, and hanging" (5.1.596-597). Although Lucio is pretty dramatic and ridiculous here, his sentiment that matrimony is a form of punishment is a central theme in the play, which you can read more about by going to "Themes: Marriage."