Sainz was sixth overall in 2019, behind only the Mercedes and Ferrari drivers and Red Bull's Max Verstappen, but has yet to win a grand prix.
Carlos Sainz will leave the team at the end of the 2020 season after two years with McLaren.
As for Sainz, the American paid tribute to the driver 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".
The Australian, a seven times race victor with Red Bull, will be the experienced man alongside 20-year-old Briton Lando Norris, with McLaren also switching from Renault to Mercedes engines in 2021.
Sainz spent 2018 with Renault earlier than shifting throughout to McLaren following Ricciardo's arrival at Enstone, signing a multi-year contract for the primary time in his profession. It seems he has now decided McLaren, who will switch to Mercedes engines next year, are the better bet for his long-term prospects.
One more said: "No its you're turn now, get bottas in the bin and bring vettel on board, i speak of behalve of the whole f****** f1 community".
"I'm pleased to announce that Carlos will join Scuderia Ferrari as from the 2021 championship", said team principal Mattia Binotto on the Italian team's official website.
And they needed to secure Ricciardo's signature before that happened.
The news was initially confirmed by McLaren on Thursday morning before Renault issued a statement soon after.
Sainz Jr., son of WRC and Dakar champion Carlos Sainz, has been in Formula 1 since the 2015 season.
None of Vettel's four titles have come with Ferrari.
Both Sainz, 25, and 30-year-old Ricciardo are out of contract at the end of the year.
Will Alonso takes the Renault seat?
Alonso said at the end of last year that he would consider a comeback to F1 after two years out, but he will have to weigh up whether he believes Renault will give him the competitive vehicle he says he wants.
The announcement that Vettel was leaving had prompted speculation that Lewis Hamilton could be set to finally make the long anticipated move to Ferrari.
He has said he views the new regulations being planned for F1 as a chance for the field to be more competitive. These have since been delayed to 2022 in light of the COVID-19 pandemic.