Petraeus had affair with biographer
The affair was discovered during an FBI investigation, according to officials briefed on the developmentsm.
Mr Petraeus renowned for taking charge of the military campaigns in Iraq and then Afghanistan, carried on the affair with Paula Broadwell, a reserve army officer, according to several US officials with knowledge of the situation.
The FBI discovered the relationship by monitoring Mr Petraeus' emails, after being alerted that Ms Broadwell may have had access to his personal email account, two of the officials said.
Ms Broadwell did not respond to messages seeking comment.
Mr Petraeus' resignation shocked Washington's intelligence and political communities. It was a sudden end to the public career of the best-known general of the post 9/11 wars, a man sometimes mentioned as a potential Republican presidential candidate.
His service was praised effusively in statements from politicians from both parties.
Mr Petraeus, who was 60 on Wednesday, told CIA employees in a statement that he had met President Barack Obama at the White House on Thursday and asked to be allowed to resign. On Friday the president accepted.
Mr Petraeus told his staffers he was guilty of "extremely poor judgment" in the affair. "Such behaviour is unacceptable, both as a husband and as the leader of an organisation such as ours."
He has been married for 38 years to Holly Petraeus, whom he met when he was a cadet at the US Military Academy at West Point, New York. She was the daughter of the academy superintendent. They have two children and their son led an infantry platoon in Afghanistan.