Politicians across Europe voiced dismay at the ruling by Poland's Constitutional Tribunal on Thursday, which they saw as undercutting the legal pillar on which the 27-nation EU stands.
According to organisers, protests took place in over 100 towns and cities across Poland and several cities abroad.
In Warsaw, protesters waved Polish and EU flags and shouted "We are staying".
Donald Tusk, who is a former head of the European Council and now leader of the main opposition party Civic Platform, said the ruling Law and Justice (PiS) party's policies were jeopardising Poland's future in Europe.
"We know why they want to leave (the EU) ... so that they can violate democratic rules with impunity," he said, speaking in front of Warsaw's Royal Castle, surrounded by thousands of protesters flanked by police vans flashing their lights.
PiS says it has no plans for a "Polexit".
But right-wing populist governments in Poland and Hungary have found themselves increasingly at odds with the European Commission over issues ranging from LGBT rights to judicial independence.
Welcoming the court ruling on Thursday, Polish Prime Minister Mateusz Morawiecki said each member state must be treated with respect and the EU should not be only "a grouping of those who are equal and more equal".
State-run TVP broadcaster, which critics say focuses heavily on presenting the government's point of view, ran a news ticker that read "protest against the constitution" during its coverage of Sunday's events.
Speakers at the demonstrations included politicians from across the opposition, artists and activists.
"This is our Europe and nobody is going to take us out of it," said Wanda Traczyk-Stawska, a 94-year old veteran of the 1944 Warsaw Uprising against Nazi German occupiers.
(Reporting by Kacper Pempel and Anna Wlodarczak-Semczuk Editing by Frances Kerry)