He will partner Alex Albon, who penned a new deal with Williams earlier this season, while the F1 future of Logan Sargeant beyond 2024 is uncertain having been displaced by the Sainz news.
Rumours have swirled around Sainz since his departure from Ferrari was announced, with the three-time grand prix winner being linked with Mercedes, Aston Martin, Red Bull and Audi in the past few months.
However, Williams emerged as a surprise contender, with team principal James Vowles suggesting talks were taking place with the 29-year-old.
Despite this, it has now become clear that Sainz will join Williams, as they search for a return to the front of the grid in the seasons to come.
Speaking to Williams' official website, Sainz said: "I am fully confident that Williams is the right place for me to continue my F1 journey and I am extremely proud of joining such a historic and successful team, where many of my childhood heroes drove in the past and made their mark on our sport.
"The ultimate goal of bringing Williams back to where it belongs, at the front of the grid, is a challenge that I embrace with excitement and positivity.
"I am convinced that this team has all the right ingredients to make history again and starting on January 1, I will give my absolute best to drive Williams forward alongside every single member of the team."
BREAKING: Carlos Sainz will join the team for '25, '26 and beyond 🤩