He also pleaded guilty to attempting to rape another woman who was jogging in San Diego and waived his right to an appeal.
Gardner, wearing a dark blue jail jumpsuit with his shackled arms hanging at his sides, said nothing but "yes" repeatedly as the judge asked him for his pleas.
Parents Brent and Kelly King, and Maurice Dubois and Carrie McGonigle were in the courtroom to hear the admissions. Kelly King and McGonigle were teary-eyed throughout the proceeding. Sobbing could be heard when Gardner entered his pleas.
District Attorney Bonnie Dumanis said Gardner led investigators to the skeletal remains of Dubois two days after authorities charged him with the murder of King. He did so on the condition that prosecutors not go public with the information or use it against him in court.
"This was a somber decision," Dumanis said. "To end the anguish of the unknown for the Dubois family and to bring Amber home, we agreed."
Officials, however, retained the ability to use any evidence obtained from the crime scene to build their case.
Escondido police and crime lab technicians worked round-the-clock to find evidence linking Gardner to the killing of Dubois, but Dumanis said they did not succeed.
Dubois vanished in February 2009, and the investigation produced few solid leads until King disappeared Feb. 25 during an afternoon run in a San Diego park about 10 miles south of the site where Dubois vanished.
Gardner was arrested three days after King disappeared. He initially pleaded not guilty to her killing.
In a surprising turn, Gardner admitted Friday to kidnapping, raping and stabbing Dubois. He also admitted dragging King to a remote area where he raped, strangled and buried her.
Gardner offered to plead guilty to both murders if prosecutors agreed to not seek the death penalty.
"Accepting this plea has been an extremely difficult decision," Dumanis said after the hearing. "We have the evidence to pursue a murder charge against the defendant for Chelsea's murder, but not for Amber's murder."
Prosecutor Kristen Spieler told the judge the victims' families agreed to the plea agreement.
Brent King, Chelsea's father, said his family wanted to spare their 13-year-old son the drama of a protracted trial and appeals process, which prosecutors said could drag on for decades.
"There's nothing satisfying about this moment. It is only one more unbearably painful day that we will have to carry in our memory as long as we live," Brent King said.
The Kings also wanted to help the grieving family of Dubois.
"While our unequivocal first choice is the death penalty, we acknowledge that in California that penalty has become an empty promise," he said.
Later he added: "The Dubois family has been through unthinkable hell the past 14 months. We couldn't imagine the confession to Amber's murder never seeing the light of day, leaving an eternal question mark."
Sentencing was set for June 1.
Defense attorneys left the courtroom without talking to reporters.
Chelsea King's body was discovered March 2 in a shallow lakeside grave after a massive search. Prosecutors said Gardner was linked to the crime by DNA found on her clothing.
The bones of Dubois were discovered March 6 in a rugged, remote area north of San Diego, a day after Gardner led authorities there. She vanished with a $200 check to purchase a lamb she was going to raise for Future Farmers of America. The check was never cashed.
Gardner served five years in prison after pleading guilty in 2000 to molesting a 13-year-old neighbor girl. Records show he later violated parole by moving too close to a school but was allowed to remain free.
Gardner's history of parole violations has led to calls to strengthen California's already stringent laws on sex predators.
Brent and Kelly King, the victim's mother, have traveled to Sacramento to announce the introduction of "Chelsea's Law," which would send some child molesters to prison for life after a first conviction and monitor others with tracking technology until they die.