A clan of bandits led by the incompetent Abis Mal return to their hideout, only to have the brunt of their loot stolen by Aladdin and Abu. Aladdin distributes the treasure amongst the poor of Agrabah – with the exception of a jewel flower, which Aladdin gives to Jasmine.
Meanwhile, in the desert, Iago manages to dig himself and Jafar’s genie lamp out of the sand where the Cave of Wonders was. Jafar orders Iago to release him, but Iago rebels against Jafar and throws the lamp into a nearby well. He returns to Agrabah, hoping to make amends with Aladdin in order to return to the palace. When he encounters Aladdin, his claim of being a slave under hypnosis does not fare well, and he is pursued. Aladdin runs into Abis Mal and his bandits, but is inadvertently rescued by Iago. Aladdin returns to the palace and jails Iago, promising to allow a fair trial. He and Jasmine are greeted by the Genie, who has returned from seeing the world and is content with staying with his friends.
At a special dinner held in Aladdin’s honor, the Sultan announces that he wants to make Aladdin his new grand vizier. Trying to draw on the good mood, Aladdin attempts to persuade the Sultan to forgive Iago, but Iago inadvertently ruins the dinner when Rajah chases him into the room as Razoul and the guards arrive. After Aladdin receives some angry comments from the Sultan and Razoul, Jasmine leaves the room heartbroken that Aladdin did not trust even her about this. With Iago’s help though, Jasmine eventually forgives Aladdin.
While Abis Mal is washing himself at a well, he sees Jafar’s lamp and when he rubs it, Jafar appears as an abominable genie. Despite being bound by the laws of obedience, Jafar manipulates his master into wasting his first two wishes, but forms an alliance to the end of exacting revenge upon Aladdin. The pair travel to Agrabah where Jafar reveals himself to Iago and coerces him into complying with his schemes. The next day, Aladdin and the Sultan depart to have a discussion about Iago’s fate, while Jafar confronts the Genie and Abu in the Palace gardens and imprisons them.
As Aladdin discusses with the Sultan, he is ambushed by Abis Mal, who is supported by Jafar’s sorcery. The Sultan is kidnapped and Aladdin thrown into the raging river. Jafar frames Aladdin for the assumed death of the Sultan and has him sentenced to death while posing as Jasmine.
Iago decides to side with Aladdin’s friends by releasing the Genie to save Aladdin. Once everyone is freed, Aladdin decides to destroy Jafar, which could only occur by destroying his lamp. Jafar and Abis Mal celebrate Aladdin’s death, but Jafar demands to be set free. Abis Mal, however, hesitates, and even after Jafar bribes him with mountains of treasure, he still refuses to set Jafar free, out of concern that Jafar’s rewards will vanish once the deal is completed. Aladdin attempts to steal the lamp but is discovered, and he and Abis Mal are blown out of the throne room into the palace garden by Jafar. Aladdin, Jasmine, the Genie, Abu and Carpet engage Jafar in combat, but even when bound by the rules of the Genie, he easily outmatches them, using his tremendous powers to prevent them from obtaining the lamp. His indiscriminate use of power opens a fissure in the ground which is filled with magma, trapping Aladdin, Jasmine, the Genie, and Abu. However, Iago arrives and grabs the lamp before getting wounded by Jafar. Iago kicks the lamp into the magma before losing consciousness. The lamp melts and submerges, destroying Jafar once and for all. Aladdin rescues Iago and flees the fissure as Jafar’s power vanishes, and everything is restored to normal as Iago awakens.
Iago is welcomed to the palace as a trusted friend and slowly recovers from his wounds. Aladdin announces to the Sultan that he is not yet ready to become a grand vizier, because he first wants to see the world. Jasmine declares that she will join him, against Iago’s protestations.
In the post-credits, Abis Mal is stuck in a tree and only now realizes that he will never have his third wish.