The American Heritage Dictionary supplies this usage note for those who wish to distinguish “sex” and “gender.”
Some people maintain that the word sex should be reserved for reference to the biological aspects of being male or female or to sexual activity, and that the word gender should be used only to refer to sociocultural roles. Accordingly, one would say The effectiveness of the treatment appears to depend on the sex of the patient and In society, gender roles are clearly defined. In some situations this distinction avoids ambiguity, as in gender research, which is clear in a way that sex research is not. The distinction can be problematic, however. Linguistically, there isn’t any real difference between gender bias and sex bias, and it may seem contrived to insist that sex is incorrect in this instance.
I used to observe this distinction; it was proposed—or rather, propounded—to me by a smart person (who reads this blog!). I wanted to sound smart, so I grabbed the rule and held on for dear pride. But since then I have worked hard to develop my ability to sniff out bogus semantic distinctions. Like I said, I couldn’t always. Can you?
While you’re learning to be a good writer, it may be better safe than sorry to observe rules smart people propound. But you probably didn’t need a “rule” to help you know that “gender research” and “sex research” mean different things. If you didn’t know that already, you just need to tune your ear by reading more edited prose. Your goal as a writer—says this one whose books don’t necessarily sell well—should be to arrive at a place where the dictionary repeatedly confirms your intuitive sense of what sounds right. A good dictionary (and the AHD surely is one) will steer you right.
Ultimately, you want to be the kind of writer who doesn’t feel bound to trust every rule he or she hears.