Sex:
: either of the two major forms of individuals that occur in many species and that are distinguished respectively as female or male especially on the basis of their reproductive organs and structures.
Gender:
: a subclass within a grammatical class (as noun, pronoun, adjective, or verb) of a language that is partly arbitrary but also partly based on distinguishable characteristics (as shape, social rank, manner of existence, or sex) and that determines agreement with and selection of other words or grammatical forms.
They usually used interchangeably.
From a thesaurus; Oh look, they reference each other!
Main Entry: gender
Part of Speech: noun
Definition: grammatical rules applying to nouns that connote sex or animateness
Synonyms: common, feminine, gender-specific, masculine, neuter
Notes: gender is the properties that distinguish organisms on the basis of their reproductive roles; sex is either of the two categories, male or female, into which most organisms are divided.
Main Entry: sex
Part of Speech: noun
Definition: male or female gender
Synonyms: femininity, manhood, manliness, masculinity, sexuality, womanhood, womanliness
Notes: gender is the properties that distinguish organisms on the basis of their reproductive roles; sex is either of the two categories, male or female, into which most organisms are divided