Health Secretary Alex Neil announced that the practice of rostering junior doctors on for seven full night-shifts in a row will end by February next year.
He also expects that by 2016, no junior doctor will work more than seven day-shifts in a row.
It comes after the death of Dr Lauren Connelly, 23, following an accident on the M8 as she drove home from work at Inverclyde Royal Hospital in Greenock, Inverclyde, in September 2011.
Her father Dr Brian Connelly told The Herald last year that she had worked 10 days in a row and later a 12-day run of more than 107 hours in the weeks before she died.
He met with the Government to discuss his concerns about junior doctors' hours.
Mr Neil said: "Scotland's NHS must continue to attract world-class staff so that it can provide truly world-class services for patients.
"We have already increased the number of staff working within NHS Scotland and are now focusing on ensuring that they have the best possible working practices.
"I am quite clear that no junior doctors in Scotland should have to work seven nights in a row and I am committed to ending this practice where, on occasion, it does exist by February next year.
"While 99% of rotas in NHS Scotland do not include a junior doctor working more than four nights in a row, we are committed to ensuring full, 100% compliance from health boards. We expect boards to observe not simply the letter, but also the spirit of the law."
Health boards have also been told to simplify the working hours monitoring process and to ensure all staff have access to appropriate rest facilities.
The average permissible number of hours a junior doctor works in a week has reduced from 58 in 2004 to 48 since August 2009.
Mr Neil said: "Since 2007, there are over 2,000 more doctors working in Scotland's NHS and junior doctors have been supported through the introduction of advanced nurse practitioners and additional support staff.
"However, we are committed to doing more and we'll continue to work with NHS boards and professional bodies to review best practice and consider how this can be used to improve the work life balance of junior doctors.
"We will also be implementing an external assessment to ensure that these actions are being taken forward by NHS boards and that junior doctors see the improvements in their work-life balance that we all desire."
Dr David Reid, chair of the BMA's Scottish Junior Doctors Committee, said: "There is a growing body of evidence to demonstrate the dangers of shift working patterns on individual doctors' performance and more importantly on patient safety.
"I am therefore pleased that the Scottish Government has set a deadline to end the practice of junior doctors working seven full night-shifts in a row by February next year. This has been the result of successful collaboration between NHS boards, Scottish Government and the BMA. It proves that when politicians and management listen to those at the frontline of NHS services, we can work together to make a dramatic difference to the working lives of doctors and improve patient care.
"Although this is welcome progress, many junior doctors still work a combination of both day and night-shifts, which for some means they can be working up to 90 hours a week. These rotas may be compliant to the letter of the European Working Time Directive, which aimed to reduce working hours, but they are not in the spirit of the legislation.
"It will be a challenge for NHS employers and the Scottish Government to achieve the target to end long stretches of day-shifts. I hope they will continue to work with us to address arduous shift working which can leave junior doctors exhausted whilst at the same time providing a high quality learning environment for doctors in training. If we achieve this, we will be closer to addressing the current problems attracting and retaining junior doctors in Scotland."