The protests lasted two days and preceded the trial of 12 Catalan separatist leaders who were charged with rebellion and misuse of public funds, after the independence referendum past year which was deemed illegal by Madrid.
The leaders of Spain's main three right wing parties - the conservative Popular Party (PP), centre-right Ciudadanos (Citizens) and far right Vox, had called the demonstration after the government's proposal to appoint a rapporteur in talks amongst political parties created to come up with agreement over the problem.
Organisers said over 200,000 people took part on the rally held under the slogan "For a united Spain".
Demonstrators gathered in the capital's Plaza de Colon, waving Spanish flags.
They claim that Mr Sanchez must resign for holding talks with separatists in the north-eastern region of Catalonia.
Even though Mr Sanchez has said he wants to see out the legislative term to 2020, a failure to win a budget vote will crank up the pressure on him to call for an early election.
"The time of Sanchez's government has ended", Popular Party leader Pablo Casado said at the protest.
"We are here to say no to separatism and yes to Spain", added Ciudadanos leader Albert Rivera.
Air NZ Flight to Shanghai Turned Away on Taiwan Reference
Full disclosure: I was asking questions of Air NZ on Sunday afternoon, suspecting it may be the start of a diplomatic incident. MBIE officials are working with China to try to reschedule the official opening.
Sanchez's minority government, came to power last June ousting a conservative government and relying on the support of the left-wing party Podemos, Catalan nationalists and other small parties.
The right wing parties accused the government of treachery over the move.
Elena Navarro, who attended the anti-Sanchez rally in Madrid with her teenaged son, said Mr Sanchez was "a traitor".
Former French prime minister Manuel Valls, who was born in Barcelona and is running for mayor of Spain's second largest city, and Peru's Mario Vargas Llosa, a Nobel Prize-winning author who became a Spanish citizen in the 1990s and has spoken out in favour of conservative Spanish causes, were among those who attended the Madrid protest.
Sánchez is facing opposition on both sides as he attempts to pass through his government's proposed budget next Wednesday.
If Sanchez fails to secure enough votes to pass the 2019 national budget, he may be forced to call snap polls.
Spain will hold municipal, regional and European Parliament elections in May.