Williams will continue to use Mercedes engines until at least 2030, the two F1 teams have announced.
The extension means Mercedes now have long-term contracts with three of the sport's 10 teams, including their own factory outfit which seven-time world champion Lewis Hamilton drives for. McLaren announced a similar deal last November.
The power unit rules are changing in 2026 in the sport's next big shake-up.
Williams have been powered by Mercedes engines since 2014 and their principal James Vowles was previously strategy director at Mercedes, joining from the Brackley-based team a year ago.
"We have enjoyed a long-term partnership with Mercedes-Benz, and we are thrilled to extend this collaboration into the next era of Formula One," said Vowles.
"The expertise, support and technology that Mercedes brings to the table align perfectly with our team's aspirations in the medium and long term. This long-term agreement with Mercedes is a positive step and forms part of our objectives for the future, whilst we will still retain our design and manufacturing expertise and capabilities in-house."
Williams ended last season seventh overall, a big improvement from 10th in 2022. They will have the same driver line-up of Alex Albon and Logan Sargeant in 2024.
Elsewhere, F1's governing body, the FIA, confirmed on Monday the departures of sporting director Steve Nielsen and technical director Tim Goss less than a year after they were appointed to the roles.
The FIA said in a statement that Tim Malyon would take over as sporting director in the single-seater department, overseeing race direction and the Geneva-based Remote Operations Centre (ROC). Niels Wittich will continue as F1 Race Director for the season starting on March 2 in Bahrain.
Canadian-born Malyon has worked for Red Bull and Sauber and joined the FIA in 2019 as head of research, becoming safety director in 2021. He reports to Nikolas Tombazis, the FIA's single-seater director.
"He will play a major role as we continue to bring rigour to our sporting and regulatory practices and procedures, and he will drive the innovation we have brought to our race control operation," said Tombazis.
"Tim has been pivotal in creating a strong synergy between Race Control and the ROC with the introduction of new technology including artificial intelligence and state-of-the-art data analysis and processing systems. He will continue to oversee advances in that area as well as taking the lead on the evolution of FIA sporting regulations."
The departures will be seen by some in Formula One as another setback for an uneasy FIA, with Deborah Mayer last month also stepping down as head of the women's commission according to unconfirmed reports in France.
The relationship between Liberty Media-owned Formula One and the FIA has deteriorated over the past year, with the two sides at loggerheads over a number of issues including possible expansion to 11 teams.
Nielsen, who has decades of experience with a string of teams, joined from Formula One as sporting director a year ago following a review ordered by FIA president Mohammed Ben Sulayem.
The appointment helped fill a void left by the death of former race director Charlie Whiting in 2019 but the BBC reported Nielsen left because he felt the FIA was unwilling to make changes he wanted.
Nielsen was quoted by the FIA as saying it had been a "fantastic experience", without giving a reason for the departure. Goss, who had a long previous career at McLaren where he served as technical director, is expected to return to Formula One in a team capacity.
"We are disappointed to lose a person of Tim's calibre from the organisation," said Tombazis. "We understand that his career is taking a new direction going forward and we support and respect his desire to pursue another path, and wish him luck for his future endeavours."