Williams switched to Mercedes power in 2014 when the V6 hyrid regulations came into force. The original contract is set to conclude at the end of the 2021 campaign.
However, a new-long term deal has been penned, which will see the two companies continue to work together for another five seasons following 2021.
"We have enjoyed a wonderful partnership with Mercedes-Benz over the past six years of what was originally a seven-year agreement, and so we are delighted to be continuing working with them for a further five years from 2021," said Williams deputy team principal Claire Williams.
"Mercedes-Benz has been one of the sport's most successful engine suppliers and we believe that they will continue to have an extremely competitive engine package going forwards.
"Over our time with them they have become a real friend of the team, and we look forward to working with Mercedes-AMG HPP (High Performance Powertrains) in the future."
In the hybrid era, Williams has finished third in the constructors' championship twice, in 2014 and 2015, picking up 15 podiums and one pole position in partnership with Mercedes since 2014.
Mercedes CEO Toto Wolff said: "Williams is one of the iconic brands in Formula One and we at Mercedes are proud to count them as part of our motorsport family.
"They have been through some tough times recently but that has only served to demonstrate their resilience and strength of character as they battle back to where they belong on the grid.
"I am certain that the outlook for independent teams is bright under the financial regulations that will be introduced from 2021 and we are delighted to continue our partnership with Williams into that new era of our sport."
Williams is currently enduring a difficult season, languishing at the back of the grod with one championship point to its name so far this season.
Andy Cowell, Managing Director of Mercedes-AMG HPP, added: "Building long-term partnerships has been a key pillar of our approach to the hybrid era in Formula 1.
"Williams has been an exemplary partner since we began working together ahead of the 2014 season and we have enjoyed a number of highlights during those years.
"We have built strong human and technical relationships to the team in Grove and very much look forward to building on them in the years ahead."
Bahrain International Circuit - Winter testing