The settlement includes guaranteed payments of about $12.7 billion, with another $5 billion contingent on whether Snap Inc's Snapchat, ByteDance's TikTok and Alphabet's YouTube impose similar protections for children.
Those companies were not immediately available for comment. Meta plans to publish a letter on Thursday in national newspapers to push TikTok and YouTube to improve protections for children. A Meta spokesperson said the company was "hopeful" Snap would make similar changes.
Wednesday's settlements also call for Meta to pay $459 million to resolve states' privacy claims related to the Cambridge Analytica scandal, where a British consulting firm collected personal data of millions of Facebook users without authorization.
The main settlement requires approval by U.S. District Judge Yvonne Gonzalez Rogers, who oversaw the trial that began on August 18.
Instagram head Adam Mosseri had begun testifying, and Meta Chief Executive Mark Zuckerberg had been expected to testify.
At a Wednesday hearing, Gonzalez Rogers called the settlement "a good step forward" and said she expected to grant approval.
"I don't want to suggest that there's anything with this agreement that I am particularly concerned with," the judge said. "I am quite happy to not have to finish up this trial."
Social media companies still face thousands of lawsuits in federal and state courts by individuals, school districts, municipalities and other government entities claiming they knowingly sought to addict children and caused a mental health crisis including harms such as anxiety, depression and suicide. Gonzalez Rogers oversees many of these cases.
The Meta trial included claims by California, Colorado, Kentucky and New Jersey that the company's conduct violated state consumer protection laws.
It also included claims by 29 states that Meta violated the federal Children's Online Privacy Protection Act by knowingly collecting personal data from children without parental consent, and using the data to train generative AI.
Meta had long argued that it could not have misled consumers because "social media addiction" was not a recognized psychiatric condition.
Earlier this month, a New Mexico judge ordered Meta to pay $567 million and implement youth safety measures, in addition to $375 million a jury ordered Meta to pay in the same case in March for misleading users about its platforms' safety.
Also in March, a Los Angeles jury found Meta and Alphabet's Google negligent in designing their platforms, and ordered them to pay $6 million to a 20-year-old woman who said she became addicted to Instagram and YouTube as a child.
Meta and Google have said they will appeal those verdicts.
Last month, the European Commission threatened to fine Meta unless it changed some product features, after preliminarily finding that the company breached a 2022 European Union regulation governing the removal of harmful content by large online platforms. A spokesperson said the commission remains in dialogue with Meta on possible changes.
New Mexico was not part of Wednesday's settlements.
New Mexico Attorney General Raul Torrez said the resolution missed some changes his case spurred in his state, including safeguards against adults targeting children and banning sexualized AI chatbot interactions with children, yet "represents real progress and adds momentum to finish the job of protecting kids online."
Florida also did not settle, and plans to keep litigating.
"The payouts to the states are peanuts compared to the profound harms Meta’s profit-driven addictive features have inflicted on our children," Florida Attorney General James Uthmeier said in a statement. "We’ll see them at trial."