It was passed by the board of the World Anti-Doping Agency (WADA) at the end of three days of deliberation by some 1,000 delegates attending the World Conference on Doping in Sport.
"We are now equipped to go forward in the best possible way with a set of rules. It's a good day for sport, for athletes and for our future," said outgoing WADA president John Fahey.
The revised code, which comes into effect at the start of 2015, doubles the ban for those found guilty of doping to four years, seeks smarter testing and targets support staff around athletes, such as errant doctors.
"I firmly believe that the revised code will put the interest of clean athletes as the number one priority," Fahey said.
The new code, which gives WADA wider powers, was the final act of a two-year process involving some 4,000 suggested changes to the last code, adopted five years ago.
Bans for drug cheats will go up from two to four years, effectively excluding them from the next Olympic Games. The code also introduces more flexibility in the punishment of athletes who are found to have mistakenly taken banned substances or who co-operate with doping investigations.
Doping policies will be custom-made for individual sports. "There is no point in the chess federation, for example, testing for human growth hormones," said Fahey.
WADA's statute of limitations will be extended from eight to 10 years, allowing anti-doping agencies to store and test samples for up to a decade and enabling retrospective testing as technology advances.
A post-conference declaration called for extra resources for WADA, co-funded by the Olympic movement and governments, and for more anti-doping legislation to be adopted by governments.
"Governments of countries without a national anti-doping organisations are encouraged to establish one or join a regional anti-doping organisation," the declaration said.
Image: World Anti-Doping Agency (WADA) President John Fahey
Photograph: Denis Balibouse/Reuters
In the end, so near yet so far...
Sachin Tendulkar is Time magazine's 'Person of the Moment'
Sachin Tendulkar... end of an era
'If I couldn't sleep all night, I wonder how Sachin Tendulkar can'
PHOTOS: Tendulkar mania grips Wankhede as India takes lead