The Scottish government has released new guidance on school safety to take account of the five-level Covid alert system, which begins on Monday.
Other guidance advises staff to wear face coverings in all schools, where social distancing is not possible.
And parents should wear masks even at drop-off and pick-up.
That applies even if they are not entering the school, Deputy First Minister John Swinney told the daily media briefing.
Mr Swinney said the main change from previous advice was for schools in level 3 and 4.
No local authority has yet been placed in level 4, the closest to lockdown.
However, most of the central belt of Scotland is in level 3, including Glasgow and Edinburgh as well as Lanarkshire, Ayrshire and the Lothians. Dundee, Stirling and Falkirk are also in level 3. About 3.5 million people in total.
Mr Swinney, who is also the education secretary, said pupils in S4 to S6 and their teachers in these areas should wear face coverings in classrooms, as well as when they are moving around the school and in communal areas.
He said: "The evidence suggests there is slightly higher infection and transmission risks for people around the age of 16 to 17 so the use of face coverings is an additional precautionary measure in areas where there is increased incidence of the virus."
The updated guidance says all adults should wear face coverings in schools where they cannot stay at least two metres away from other adults and pupils - although Mr Swinney said there were some exemptions to this for primaries one and two.
Staff in primary schools should now wear face coverings in communal areas, such as staff rooms, canteens and corridors.
Mr Swinney said none of the areas in the new framework for dealing with Covid required school closures or blended learning. Although he said that remote learning remained a "contingency".
Guidance for school staff and pupils at the highest clinical risk (shielding) has also been updated.
At Level 3, parents or guardians should discuss with their GP or clinician whether children who are shielding should attend school.
At Level 4, the current advice is that children on the shielding list should not attend school in person. However, the government said it would look at how it could use individualised risk assessments to maximise attendance.
Also at this highest level, greater levels of testing will be required in response to outbreaks in schools.
Scotland's biggest teaching union, the EIS, said it supported stronger advice in areas such as the use of face coverings.
But it was "dissatisfied" with the lack of specification on social distancing between pupils, which it said remained impossible to achieve in full classrooms.
General Secretary Larry Flanagan added: "The EIS is clear that Level 4 should trigger an automatic consideration of moves towards blended or remote learning. Schools cannot stay open at any cost; the safety of pupils and staff has to be the priority, especially those with increased vulnerabilities."
Scottish Conservative education spokesman Jamie Greene said: "Parents across Scotland understood the guidance around staff wearing masks in schools, and older pupils wearing them in public areas, but the SNP has not explained why this latest move is necessary.
"Nor have they addressed legitimate concerns about pupils' wellbeing, particularly for those with additional support needs."
UsForThem Scotland, a group campaigning for normal schooling through the pandemic, also asked for data on how effective mask-wearing in school was.
Success usually comes to those who are too busy to be looking for it.