I couldn't find it in the Oxford Idioms Dictionary, but I've heard it a couple times from people who'd been unjustly favored over, and who possibly didn't mean to imply a sexual relationship:
-Why did he get promoted? You're so better than him.
-That guy is sleeping with the boss.
I know that as a metaphor, this expression is well capable to convey favoritism. What I want to know is whether it's commonly used in that sense, i.e., whether it's a well known idiom or not.