In front of Olivia's house, Feste holds the letter that Malvolio has written begging for Olivia's help. As Fabian tries to get Feste to let him read it, Orsino arrives with Cesario and several others. After exchanging some casual banter with Feste, Orsino sends the clown to inform Olivia of his arrival.
As Feste and Fabian engage in a kind of power struggle over the letter, Orsino arrives and shows who has the real power.
While Orsino waits, the officers barge in with Antonio. Cesario defends Antonio—noting that Antonio saved him from Sir Toby and Sir Andrew—but concedes that he did seem crazy. Orsino asks Antonio why he came to Illyria, where he knew it would be dangerous for him. Antonio explains that he came to serve the "ingrateful boy" (5.1.72)—Cesario, whom he still mistakes for Sebastian. He says that he saved this "boy" from a shipwreck and, from then on, followed and defended him, "pure for his love" (5.1.78) Yet, when Antonio was arrested, the boy ignored him, refusing even to return the purse, which Antonio had lent him. Cesario is mystified. Orsino asks when the boy Antonio is talking about arrived in Illyria. Antonio replies that they arrived today, having spent the past three months together. As Olivia approaches, Orsino tells Antonio that he is mad, considering Cesario has been in Illyria for the past three months.
The characters' use of indirect language like "ingrateful boy" draws attention to the fact that confusion about Viola/Cesario's and Sebastian's identities is reaching a climax. Antonio's description of his "pure love" for his master really is impressive. He hasn't just talked about his love, as all the other characters do, he has acted on it and shown his master nothing but devotion. Some critics argue that this extreme devotion can only be motivated by homoerotic desire on Antonio's part, but one can also see it is as offering a contrast to all the other loves on display in the play. Only Antonio's love is pure, honest, and completely out in the open.
Olivia demands to know where Cesario has been. Has he broken his marriage promises to her already? Cesario is confused. Orsino, who now thinks that Cesario has wooed Olivia in secret, grows enraged. He tells Olivia he should kill her out of "savage jealousy" (5.1.113), or kill Cesario to spite Olivia, although he holds his page boy dear. Cesario replies that to give Orsino rest, he would die a thousand deaths: he loves Orsino more than he will ever love a wife. Horrified, Olivia fetches the priest who has just married her to Sebastian. The priest confirms that he has sealed an "eternal bond of love" (5.1.151) between Olivia and Cesario. Hearing this, Orsino storms off, disgusted, while Cesario struggles to stop him.
Orsino's rhetoric about his "jealousy," like many of his other speeches, is clichéd. He always seems to be playing a part, rather than feeling true emotions. In the escalating confusion, Viola/Cesario declares her thwarted desire for Orsino and love-melancholy more directly than ever before: both "rest' and "dying" are English Renaissance terms for sexual climax. The Priest, seeking to restore order, only adds to the chaos.
As Orsino is leaving, Sir Andrew enters, bleeding and calling for a surgeon. He accuses Cesario of injuring him. General puzzlement descends upon the group. Sir Toby, also bleeding, enters with Feste and joins in accusing Cesario. Olivia sends them away to have their injuries tended and demands to know who is actually responsible.
With Andrew and Toby's dramatic entry, the comic subplot of the servants returns, adding to the bewilderment about Cesario's identity. The Viola/Cesario disguise resides at the center of nearly all of the chaos in Twelfth Night.
At this moment, Sebastian rushes in, apologizing to Olivia, begging her pardon for having hurt her kinsman. Everyone is astonished. Orsino exclaims that Sebastian and Cesario are identical: "one face, one voice, one habit, and two persons" (5.1.208). Antonio says, "an apple, cleft in two, is not more twin" (5.1.216), while Olivia exclaims that what they are seeing is like magic, "most wonderful" (5.1.217).
Once Sebastian and Cesario are together, all the confusion that has been set in motion by Viola's disguise can be resolved. However, at first, many of the characters seem to think that they are hallucinating—the twins in front of them seem to have traded, or lost, identities.
Through a series of questions, Sebastian and Viola identify each other and rejoice: they are reunited! Yet, Viola says to the confused onlookers, Sebastian should not embrace her until she has discarded the "masculine usurped attire" (5.1.241) that has been her costume, and proven who she is to everyone's satisfaction. To do this, she must return to the Captain who saved her from their shipwreck, knows her story, and has her old clothes.
Overjoyed to be reunited with the brother she loves, and out of mourning, Viola discards her class- and gender- disguise. But to dispel the madness that she has set in motion, she will require someone else to confirm her story independently.
Sebastian turns to Olivia to explain: all that time, she wanted to marry a woman. Orsino reassures Olivia, telling her that the twins have noble blood. He then turns to Viola and says that he often heard Cesario swear that he would never love a woman as he loves Orsino. Is it true? Viola affirms that it is. Then, Orsino continues, she should give him her hand and let him see her in her "woman's weeds" (5.1.265) or clothing. Viola replies that the Captain who brought her to shore from the shipwreck has her clothes. But he is currently tied up in some legal suit led by Malvolio, a servant of Olivia's…
Finally, all the confusion about gender and identity that Viola's disguise created starts to be tidied up. Yet Orsino's love seems almost ridiculously fickle, as he instantly changes its object from Olivia to Viola. In addition, just as Olivia seemed attracted to Cesario's womanly features, Orsino now is attracted to Viola not after she has appeared as Viola, but while she is still in the costume of the Cesario.
Olivia instantly agrees to take care of this minor detail—which reminds her that, distracted by her own "frenzy," (5.1.273), she has completely forgotten about Malvolio. At this moment, Feste enters, holding Malvolio's letter. The letter warns Olivia that Malvolio will show the world how she wronged him: he still has the letter in which Olivia instructed him to adopt the costume and behavior for which all the others have called him mad. Olivia remarks that the letter does not sound like it was written by someone crazy. She sends Fabian to fetch Malvolio from the cell where he has been imprisoned.
Olivia's reference to her own "frenzy"—a word for both madness and sexual desire—and the parallel between Malvolio's letter and the love letters that have preceded it, reinforce the theme of how close love can be to madness. The confusion caused by the servants' deception, is about to be clarified, like that caused by Viola's costume has been.
Waiting for them to return, Olivia asks Orsino to think of her as a sister and offers to host a wedding feast for all four of them. Orsino accepts. He releases her from his service and from the persona of Cesario.
It seems that all confusions and conflict have been tidied up.
Malvolio enters with Fabian. Fuming, he presents Olivia with Maria's trick letter. After a quick examination, Olivia replies that the handwriting is Maria's, and she realizes that Maria and the others must have pulled a prank on Malvolio. Although Olivia initially promises Malvolio that she will let him punish the guilty parties, Fabian defends himself, as well as Sir Toby and Maria—who, he reports, have just been married. He convinces Olivia that, all in all, the whole thing was a good joke, not to be taken too seriously. Feste interjects that it was he who played Sir Topas. Enraged, Malvolio declares that he will revenge himself on everyone present, and storms off-stage. Orsino sends Fabian to try to appease him, because they still need news from Viola's loyal Captain.
Now the servants' comic subplot is fully resolved. Yet Malvolio never gets any sort of revenge or even much sympathy for the prank he has had to endure. Instead, he gets only humiliation. The fact that he walks offstage furious, while everyone else is celebrating shows how love can be cruel, despite the happy ending worked out here.
Orsino says that when the Captain has given his account, he and Viola and Olivia and Sebastian will be properly married. Aside, he adds that as long as Viola is still dressed as Cesario, he will call her "Cesario" and think of her as a man, but that once he has seen her in her "other habits" (5.1.376) she will be his mistress and the queen of his love. All exit.
In the moment of resolution, the homoerotic aspect of Orsino's attraction is particularly present: he affirms that he still thinks of Viola as a pageboy, besides using the more conventional metaphors of master and mistress.
After the others have departed, Feste remains alone on stage, singing a melancholy song about growing old that ends with the gloomy refrain: "The rain it raineth every day" (5.1.381).
This melancholy ending, like Malvolio's departure, shows that despite the temporary happy ending for the lovers, life is still full of sadness and death. That the play ends with its "lowest" character on stage is appropriate to the inversion of hierarchy associated with the real Twelfth Night festival. It also reminds the audience of the parallels between the workings of the play and the deceptions and performances it contains.