As You Like It is obsessed with the nature of love and desire. In the play, Shakespeare demonstrates over and over again how love can make people do some pretty risky and foolish things. In particular, the play spends a lot of time critiquing the artificiality of "courtly" romance and reminds us of the silliness of assuming the clichéd pose of a "Petrarchan lover" (check out "Characters: Orlando" for more on that.).
As a Shakespearean comedy, As You Like It steadily works its way toward (four!) marriages. Yet, the play is more than a little anxious about what happens after a couple gets hitched. Shakespeare raises the possibility that heterosexual unions aren't everything their cracked up to be – hence, the numerous cuckold jokes that suggest all men (regardless of age and social status) are destined to be cheated on by unfaithful wives. To complicate matters further, the play also explores the possibilities of same-sex desire between Phoebe and Rosalind, Rosalind and Celia, and "Ganymede" and Orlando.
Rosalind remains in her "Ganymede" disguise longer than necessary in order to teach Orlando to be a better boyfriend/husband.
Though four couples get hitched at the end of the play, Shakespeare doesn't intend us to view this as a "happily ever after" for all of them.