The demonstration was organised by Houthi rebels, who occupy the city and much of Yemen's north.
The rallies in Sanaa came on the second anniversary of the Saudi-led military intervention against the Houthi rebel movement.
More than 7,600 people have been killed in the conflict since it began in March 2015.
Millions of citizens have been displaced and the country has also been pushed to the brink of famine.
The war is being waged between forces loyal to President Abdrabbuh Mansour Hadi and those allied to the Houthis.
A Houthi rebel stands guard as allied army officers salute
The Houthis support the country's former authoritarian president, Ali Abdullah Saleh, who ceded power to Mr Hadi in 2012 after a 2011 uprising.
Mr Saleh made a rare appearance at Sunday's rally and addressed the crowds.
A man waves traditional daggers, or Jambiyas, as he protests
The throngs converged in Sabeen Square, where they waved the country's flag and chanted that they would "resist to the end".
"I participated in the protests against the aggression [by the Saudi-led coalition]. Maybe our voice will be heard by the world over to stop the war,'' one protester, Ahmed Mohsen, told The Associated Press news agency.
A Yemeni photographer takes photos of a rally in Sanaa
The conflict has its roots in the failed political transition after Mr Saleh handed power to Mr Hadi.
Houthis opposed to Mr Hadi took over the capital, Sanaa, forcing him to flee to the southern port city of Aden.
Alarmed by the rise of a group they believed to be backed militarily by regional Shia power Iran, Saudi Arabia and eight other mostly Sunni Arab states began an air campaign aimed at restoring Mr Hadi's government.
However, after two years of fighting, no side appears close to a decisive military victory.
Various rounds of UN-mediated peace talks to end Yemen's conflict have failed.