Gender refers to an individual's anatomical sex, or sexual assignment, and the cultural and social aspects of being male or female.
An individual's personal sense of maleness or femaleness is his or her gender identity.
Outward expression of gender identity according to cultural and social expectations is a gender role. Either gender can live out a gender role (for example, being a homemaker) but not a sex role, which is anatomically limited to one gender (gestating and giving birth being limited to females, for example).
An individual's sexual orientation refers to her or his relative attraction to members of the same sex (homosexual), other sex (heterosexual), or both sexes (bisexual).
All of these—gender, sexual assignment, gender identity, gender role, sex role, and sexual orientation—form an individual's sexual identity.