Hospital inspectors will have the power to close wards to new patients from April if the measure is approved by Holyrood.
The Scottish Government has acted to change the law after the inquiry into the deadly Vale of Leven C. diff outbreak.
Regulations have been laid before the Scottish Parliament that would allow Healthcare Improvement Scotland (HIS) inspectors to close wards as a last resort to protect patients.
The move will fulfil a key recommendation made by Lord MacLean, whose inquiry found that C. diff was a factor in the deaths of 34 out of 143 patients who had tested positive for the infection at the West Dunbartonshire hospital in 2007 and 2008.
Health Secretary Shona Robison said: “We already have a very robust scrutiny and inspection regime – with nearly 100 inspections carried out each year by Healthcare Improvement Scotland.
“However, protecting patient safety is of critical importance and that is why we want to go further and give HIS the powers to close hospital wards if they consider it necessary.
“Let me be clear that this would only ever be used as a last resort and in the majority of cases we would expect HIS to work with health boards to put in place improvements on wards first.
“But on the very rare occasions that inspectors have concerns about the safety of patients on a ward, they should have the powers to take firm and direct action. This will not just be for reasons of cleanliness, but also for other safety reasons such as staffing levels.
“The proposed changes to the legislation will strengthen the scrutiny in our hospitals and give patients the confidence and trust in the fact that their care will continue to be among the safest in the world.