Sayyidatuna ‘Aishah (radiyallahu’anha) reported that Nabi (sallallahu’alayhi wasallam) mentioned:
When the woman precedes the man in climax, the child resembles his maternal family. When the man precedes the woman, the child resembles his paternal side.
(Sahih Muslim, Hadith: 713. Also see Fathul Bari, Hadith: 3938 for other similar narrations)
Sayyiduna Thawban (radiyallahu’anhu) reports that Rasulullah (sallallahu’alayhi wasallam) said -as part of a lengthy Hadith-
When the man and woman copulate, and the man’s semen dominates [is more than] the semen of the woman, the child is born a male, with Allah’s command. When the woman’s semen dominates the man’s, then the child is born a female, by the command of Allah.
(Sahih Muslim, Hadith: 714)