While Hubie, Marina, Rocko, Splatter, Petra, Beanie, Timmy, Pikatwo, Bonkers, Fawn, Buck and Stanley are on a visit to Agrabah, a clan of bandits led by the incompetent Abis Mal attempt to 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. He even gives a bag of treasure to Hubie and his friends, for their future travels.
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, Jasmine, Hubie and his friends 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. Only Hubie and his friends are not offended by Aladdin's action, figuring he may have had a good reason. With Iago's help though, Jasmine eventually forgives Aladdin.
While Abis Mal is washing himself at a well, he runs into 009 Domino who is out for revenge on Hubie and his friends yet again. After a brief conversation they see Jafar's lamp and when Abis Mal rubs it, Jafar appears as an abominable genie, along with Drake. 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. He even agrees to help Domino against Hubie and the others, after learning that both she and Drake have a score to settle with the team.
The villains 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 with Hubie, Marina, Rocko, Splatter and the bird kids to have a discussion about Iago's fate, while Jafar and Domino confront the Genie, Abu, Bonkers, Fawn, Pikatwo, Buck and Stanley in the Palace gardens. Jafar imprisons them, but not before placing a hypnotic spell on Pikatwo, which turns him against his friends. Domino is capable of giving Pikatwo orders.
As Aladdin discusses with the Sultan, he, Hubie and he others are ambushed by Abis Mal, who is supported by Jafar's sorcery. The Sultan is kidnapped, Hubie and his friends are thrown in the dungeons with the rest 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. Drake on the other hand has Marina chained to him and plans to have Jafar bond them in marriage.
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, thus also breaking the spell on Pikatwo. Jafar, Domino, Drake and Abis Mal celebrate Aladdin and Hubie's deaths, 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. Drake argues that Abis Mal has gotten all he wants and demands that Jafar will marry Marina to him.
In the heated argument, 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, Carpet, Hubie and his friends engage Jafar and Domino in combat, but even when bound by the rules of the Genie, Jafar 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 everyone. However, Iago arrives and grabs the lamp before getting electrocuted by Pikatwo, still under Domino's influence. 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. The chains holding Marina and Drake together vanish.
Pikatwo wakes from his trance and upon realizing the damage he has done to Iago, glares at Drake and Domino and prepares a Thunder attack. Drake is horrified and asks Domino if this is what it's like to blast off. Domino agrees and tells Drake to say the last motto with her. Pikatwo delivers a powerful Thunder, sending Drake and Domino into the air, shouting "We're blasting of agaaaaaiiinnn!!!"
Everything is restored to normal as Iago awakens.
Iago is welcomed to the palace as a trusted friend and slowly recovers from his wounds, while Pikatwo apologizes to him over and over again. 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. Hubie and his friends continue their journeys.
In the post-credits, Abis Mal is stuck in a tree and only now realizes that he will never have his third wish.