I haven't heard this phrase commonly used. I've only heard it in bad TV shows and movies.
It is used when something is so good, you would prefer it to having sex. For example: "This chocolate is better than sex".
I would call it a vulgar expression because of the sexual connotations.