BOSTON (AP) -- The Massachusetts House has advanced a bill that authorizes the state to borrow up to $12 billion for transportation projects across the state.

The measure was approved unanimously late Wednesday night after lengthy negotiations over dozens of amendments.

The bill includes $2.2 billion for the extension of commuter rail service to New Bedford and $1.3 billion for the extension of the Green Line to Somerville and Medford. It also includes $300 million for road and bridge upgrades, and would provide improvements for South Station in Boston and Springfield’s Union Station.

The measure, which now goes to the Senate, authorizes borrowing but does not guarantee all the projects will be funded.

A transportation financing bill passed by lawmakers last year provides more money to repay bonds for transportation projects.