Sahih Bukhari Volume 1, Book 5, Hadith Number 292

Narated By Ubai bin Ka’b : I asked Allah’s Apostle about a man who engages in sexual intercourse with his wife but does not discharge. He replied, “He should wash the parts which comes in contact with the private parts of the woman, perform ablution and then pray.” (Abu ‘Abdullah said, “Taking a bath is safer and is the last order.”)