Sa'id bin al-Musayyib or Abu Salamah (the doubt is from Sufyan) narrates from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "The child belongs to the (owner of the) bed, and for the adulterer is the stone."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب اللعان / 15329