All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
The Prophet said: “The child is to be attributed to one on whose bed he is born, and for an adulterer there is stoning.” [Al-Bukhari and Muslim]
The Hadeeth means that if a person has a wife, she automatically becomes for him alone as a lawful sex-partner. Thus, if she gives birth six months following their intimate relations, then the child belongs to him and he is considered his legitimate father. The rulings of a father and child such as inheritance, etc, are effective between them regardless whether or not the child resembles his father. The lineage of this child would be cancelled only if the husband denies his child and performs "Li'aan" (invoking mutual curses). If he does not perform Li'aan, the child is attributed to him since he is the only lawful sex-partner of his wife. This is the opinion of the majority of Muslim scholars, including the Shaafi'i and Hambali Schools of jurisprudence. This is also one of the opinions of Imam Malik which is adopted by the majority of his followers.
Therefore, we inform our inquiring brother that the child belongs to that husband except if he performs Li'aan. The way of Li'aan is that he has to take four oaths that the child is not his and in the fifth oath he invokes the curse of Allah upon himself if the child is his. If he does so, then the child is not traced back to him.
In the situation mentioned in the question, he cannot perform Li'aan since he does not know that it is not his child.
As for the wife, if she has made sincere repentance, then there is no problem to keep her as wife. But, if she is still persisting in sin by committing illegal sexual intercourse, then he should divorce her. Approving a wife who practices Zina is an act of cuckold; a cuckold is threatened with not entering Paradise as mentioned in a Hadeeth.
Allah knows best.