Ricciardo was rumoured to be in the running for the Ferrari seat, however the unfolding situation has led him to join McLaren, who ended the 2019 season fourth in the constructors' championship.
McLaren CEO Zak Brown said: “Signing Daniel is another step forward in our long-term plan and will bring an exciting new dimension to the team, alongside Lando. This is good news for our team, partners and of course our fans.
“I also want to pay tribute to Carlos for the excellent job he has been doing for McLaren in helping our performance recovery plan. He is a real team player and we wish him well for his future beyond McLaren.”
Ricciardo linked up with Renault in 2019 after spending five years at Red Bull, where he achieved seven race wins and 29 podiums.
In 2019, McLaren secured its first podium finish since the opening round of the 2014 season as it aims to build itself back towards the front of the grid following a handful of difficult years.
Ricciardo will partner Lando Norris at the team, who made his F1 debut last year, taking a best result of sixth place in Bahrain and Austria.
McLaren team principal Andreas Seidl added: “Daniel is a proven race-winner and his experience, commitment and energy will be a valuable addition to McLaren and our mission to return to the front of the field.
“With Daniel and Lando as teammates, I believe we have two racers who will continue to excite our fans and help the team grow.
“Carlos is a true professional, a pleasure to work with and we will continue to enjoy going racing with him this year. We all wish him good luck for the next stage in his career when he leaves McLaren.”
Bahrain International Circuit - Winter testing