The moment Sora and his friends return, they learn that Jafar has escaped from the lamp because of the street vendor. Aladdin joins Sora again to confront the evil genie. After searching for him in the desert ruins, Sora finally finds him. The battle begins between the two, to which Sora is victorious. After Jafar is defeated, peace is restored in Agrabah. At the farewell, Aladdin encourages Sora, telling him that he will find Riku.
After the scenes go to the outer gate of Agrabah (On the outskirts of the city; from the main area of Agrabah, you go to the Market and from there you go to the large wooden gate). I recommend that you take advantage of this opportunity to defeat Heartless and consequently gain experience. When you leave the city another scene will start. Save your game at the Save Point, and then proceed along the path near Iago (to the West). An event will start soon.
Check how the carpet moves, and then head forward to start an event where you will have to kill the Heartless. The magic carpet may take some getting used to, but that's exactly what this fight is for. Once you've defeated all the Heartless, pursue Jafar's shadow. When she tries to cast a spell, approach her and hit her to interrupt the spell. After the cutscene continue to chase him, but now taking care of the Heartless. Later another event will start in which you will have to kill more Heartless.
Now a monument has appeared. Examine them. You will be shown the location of the three switches. The first is under the bridge near the monument (You have to approach the spheres, and once they surround you, you perform Fira when their color is red). The second is under some ruins within the ruined town (You wait for the spheres to align, and then you perform Blizzaga when they are white). The third and last is on top of one of the towers in the town of ruins (it is the furthest) - To activate the switch you will have to wait for the spheres to line up, and then perform Thundara when they are yellow.
Once you act the three switches / switches, you will have to quickly fly back to the tower with the monument, and get through the hole that was shown to you in the scene; don't worry about the Heartless, just fly to the hole as fast as you can. You will enter a ruined chamber. Open the two chests here to get the map of the ruins: Ruins Map, and some torn pages (Torn Pages). Save your game at the Save Point, and continue along the path. After the cutscene you will participate in a fun event where you will move sideways, hitting the Heartless to crash them against other objects.
Return to Agrabah. Save your game using the Save Point in the merchant's shop. Then head to the palace (before entering the palace you can interrogate the merchant). Get ready for the Boss fight.
After defeating Yafar see the scene, and then you will receive the Wishing Lamp, which increases the amount of Munny spheres, MP, and HP that enemies drop.
First attack Jafar in the stomach until you "defeat" the stomach. When this happens use the Reaction Command to rise up to Jafar's head and hit him as many times as you can. Jafar's life is that of his head, but hitting him in the stomach renders him immobile for a while allowing you to attack his head without the boss's annoying counterattacks. You can also hit their hands, but this is irrelevant.
During the fight you will have to take care of the two towers that Jafar will use to hit you. My only advice here is to move quickly, and constantly perform Heal to regain your HP. Eventually you will enter a black zone, in which you will not be able to attack Jafar, so you will have to dodge things until you return to normal and can resume your attacks. In the last phase of the fight you will have to be fast, because the Boss will also attack you with rays.