The issue has tapped into the anxiety among many parents over how to limit their children's screen time, especially in the wake of revelations about invasions of online privacy by technology companies.
Education Minister Jean-Michel Blanquer called it "a law for the 21st century, a law for addressing the digital revolution."
"It's a signal to French society of the stakes for our society," he said in parliament. "Being open to technologies of the future doesn't mean we have to accept all their uses."
Nine of every 10 French students aged 12 to 17 owns a mobile phone, according to a 2016 survey.
Teachers complain of pupils sending text messages and chatting on social media during class time.
The law being proposed would require primary and junior high students to keep their phones in backpacks or otherwise out of sight.
Already roughly half of the country's 51,000 elementary schools and 7,000 junior high schools outlaw their use.
"We're not talking about a big bang, but we backed the legislative route because it reinforces the process," Philippe Vincent of the SNPDEN union of school directors told AFP ahead of the parliamentary vote.
But the law does not codify any specific punishment for their use, and lawyers have noted that teachers do not have the right to seize non-dangerous belongings from students.
Critics also say the law will prove ineffective, saying students could easily be scrolling through social media or swapping Snapchats while pretending to rummage through their backpacks.
And some teachers chafe at calls for them to put away their phones during school hours as well, noting they are the main source of alerts in case of
But Richard Ferrand, head of Macron's Republic on the Move party in parliament, said the law would be accompanied by efforts to explain the importance of limiting phone use to students.
"When, on a playground, you see young people next to each other all staring at their phones," the consequence is "to break the link of camaraderie and sharing," he said ahead of the debate.