Updated at 4:37 p.m.

A $52.7 billion annual budget sailed through the state Legislature Monday afternoon, winning the approval of all 40 state senators and 153 representatives.

The final budget is a compromise bill filed Sunday night after about five weeks of closed-door negotiations that stretched past the July 1 start of the fiscal year. If Gov. Charlie Baker signs it in full, it will increase spending by about $5 billion over last year's $47.6 billion budget that Baker signed in July 2021. Baker gets 10 days to review the budget before signing it and issuing any vetoes or amendments.

It also includes several policy measures, like banning marriage of people under age 18 in Massachusetts and eliminating fees for parole and probation.

The conference committee that produced the final budget, led by chairs Rep. Aaron Michlewitz and Sen. Michael Rodrigues, boosted its price tag beyond the versions the House and Senate approved this spring, which each totaled around $50 billion.

Before the vote, Michlewitz said the budget aims to take advantage of strong revenue growth, build a more equitable economy and help with continued recovery from the COVID-19 pandemic.

Legislative and Baker administration budget writers had originally estimated that Massachusetts would collect $36.9 billion in revenue this year. Buoyed by ahead-of-expectations tax collections for the 2022 fiscal year, the conference committee increased the revenue projections for this year by $2.66 billion, giving lawmakers more money to spend.

In order to make use of that extra money, the deal in some cases funds accounts at higher levels than either the House or Senate used in their budgets — for instance, nearly $315 million for administration of the Trial Court, and almost $23.4 million for the Massachusetts Cultural Council.

The budget would boost state aid to local school districts to nearly $6 billion, a roughly 9% increase over last year’s budget. It also includes $110 million to make school meals free to all students, regardless of household income.

The bill would steer $266 million into a reserve fund to help the MBTA finance “projects to address ongoing safety concerns” as identified in a Federal Transit Administration review.

It also calls for a two-year pilot program expanding eligibility for ConnectorCare, the state's subsidized health insurance program, to people earning up to 500% of the federal poverty level, or about $139,000 for a family of four. The advocacy group Health Care for All said the pilot would mean an estimated 37,000 additional Massachusetts residents would be eligible for more affordable coverage.

"We hear every day on our HelpLine from people who desperately need access to care but can not afford it," Health Care for All executive director Amy Rosenthal said in a statement. "Instead, they delay care or face difficult choices in deciding whether to see a doctor or pay their rent."

A new line item in the budget would dedicate $2 million to grants supporting reproductive health care access, infrastructure and security. The conference committee left out Senate-backed language that would provide new legal shields for patients and providers of reproductive and gender-affirming health care.

Responding to the Supreme Court’s decision overturning Roe v. Wade, the House and Senate have each now passed separate, standalone bills to provide those protections. Those bills, which contain different language around abortions after 24 weeks of pregnancy, are among several major pieces of legislation still being negotiated as the Legislature approaches its July 31 end of formal sessions.

The July 31 deadline could also give lawmakers a tight timeline to override any budget vetoes if Baker takes his full 10 days to review the spending plan.

This story was updated to include details after legislators' vote.