The government schools standards bill was unanimously passed by the assembly.
Education Minister Leighton Andrews led the debate on the School Standards and Organisation (Wales) Bill on 15 January 2013.
The bill will allow ministers or local authorities to intervene earlier when faced with schools that cause concern.
Local councils will now have the final say on whether to close or merge schools.
Those functions currently lie with ministers, but Mr Andrews was concerned about the system since it allowed a single objector to hold up the process.
The bill also enables parents to raise a petition to force authorities to meet with them to discuss their concerns.
Other parts of the bill concern provisions to improve schools, Welsh in education strategic plans and school counselling.
A specific grant for free primary school breakfasts is being transferred into councils' main revenue funding, but the bill tries to protect breakfasts from funding cuts.
It gives authorities a duty to pay for breakfast if the governing body of a school asks for them.
Free breakfasts, which were introduced in 2004, has been a subject of constant political disagreement in the assembly, and the issue proved to be the only real point of contention during this debate.
Conservative education spokesperson Angela Burns argued that it is "morally indefensible for children of top-rate tax-payers to receive free school breakfasts."
The education minister tore into the UK government's economic record.
"They got rid of Comet, they got rid of Jessops and now they're getting rid of HMV," said Mr Andrews.
"We will not take lectures from them on the economy, but we will prioritise giving children free school breakfasts."
The bill becomes the third piece of primary legislature that the assembly has passed, following the Local Government Byelaws (Wales) Bill and the National Assembly for Wales (Official Languages) Act 2012.
Read this in Welsh.