Okay, so Jafar is toast (yay), and Aladdin and Jasmine have affirmed their love for each other (double yay), but it's not time to live happily ever after quite yet. See, there's still that pesky law that says Jasmine has to marry a prince. Now, Aladdin's got some real soul searching to do:
JASMINE: Oh, that stupid law. This isn't fair—I love you.
GENIE: Al, no problem. You've still got one wish left. Just say the word and you're a prince again.
ALADDIN: But Genie, what about your freedom?
GENIE: Hey, it's only an eternity of servitude. This is love. Al, you're not gonna find another girl like her in a million years. Believe me, I know. I've looked.
ALADDIN: Jasmine, I do love you, but I've got to stop pretending to be something I'm not.
JASMINE: I understand.
ALADDIN: Genie, I wish for your freedom.
This is a true turning point for Aladdin. To keep his promise to the Genie, he has to give up a chance to be with the woman he loves. And he chooses to honor his word.
That's hero stuff right there.
But it's not all about sacrifice. Aladdin knows he can't be with Jasmine under false pretenses: he's gotta be himself. No more pretending to be a rich and fancy prince. He's just Aladdin, and if that means he's not good enough to marry Jasmine, then so be it.
Let's just cross our fingers and hope that's not it.
So what happens? Well, suddenly, after the course of the whole dang movie, the Sultan wakes up and remembers he has total legislative authority over Agrabah:
SULTAN: That's right. You've certainly proven your worth as far as I'm concerned. It's that law that's the problem.
SULTAN: Well, am I sultan or am I sultan? From this day forth, the princess shall marry whomever she deems worthy.
JASMINE: Him! I choose...I choose you, Aladdin.
Wow. So it was that easy, all along. All the Sultan had to do was click his heels together three times and say, "There's no place like Agrabah." He could have avoided a whole lot of sulky teenager fights with his daughter if he'd remembered this earlier…but we digress.
This is a truly happy ending. Aladdin and Jasmine fly off on the magic carpet. The Sultan actually does something sultany. The lovebirds sing "A Whole New World" once more, for old times' sake. There are fireworks. And even the Genie gets in one last meta joke. It's the happily-ever-after these folks all deserve.