popmuse, if the YA I've read recently is any indication, swearing, sex, and drugs are no longer dealbreakers (the Gossip Girl series seems to delight in indulging in all three). At a panel on YA at ConFusion in January, Scott Westerfeld (author of the hugely popular Uglies series) said "There are only two things you can't do in YA: Bestiality and boring. And if you have to do one, make it bestiality."
But yeah, the line is extremely blurry. If it's meant for a reader grade 6-10ish, it's probably YA. If it's meant for a reader grade 4-7ish, it's probably middle grade.* The age of the character might be an indicator, but not always-- the first two Harry Potter books are YA even though he doesn't turn 13 until the third, and The Hobbit is considered YA even though the MC is well beyond his teenage years. The best advice I've heard about it is to write the book and let the editor decide how to market it.
*And yes, I know people are going to say that middle grade is 6-8 and YA is 9-12. But I'm not that long out of the grades in question, and my friends and I and all my classmates were reading Middle Grade by fourth grade, YA by sixth, and general fiction by eleventh. And publishers were marketing those books to us at those ages.