Opposition leaders, including two former presidents, led the rally against what they describe as the government's anti-democratic policies.
The ruling Law and Justice party has been criticised by the European Union over its reforms of the judiciary, surveillance, and media laws.
The party rejects the accusations.
Saturday's demonstration in the Polish capital was organised by Committee for the Defence of Democracy (KOD).
People blew horns and waved both Polish and EU flags as they walked through central Warsaw.
The opposition said about 50,000 people took part in the protest. Police estimated about 10,000 people were on the streets.
Former Presidents Aleksander Kwasniewski and Bronislaw Komorowski were among the protesters.
The participants wanted to celebrate the end of communism after 4 June 1989 elections.
But they also wanted to voice their opposition to what they see as the government's backsliding on democracy, the BBC's Adam Easton in Warsaw reports.
The Polish government passed legal amendments late last year which change the way the Constitutional Court operates.
The changes require a two-thirds majority of the 15 judges to support a ruling for it to be valid, and also stipulate a quorum of 13 judges for rulings to be valid.
Critics have said the changes mean the court is now unable to examine government legislation.
The European Commission and the  Council of Europe say the changes undermine the rule of law.
Recently approved media laws have also placed public radio and TV under a new national media council and have given the treasury minister the right to hire and fire management.
Despite the criticism, the government is trouncing the opposition in the polls thanks to a sharp hike in child benefit payments, a plan to build cheap housing and its outright refusal to take in Muslim migrants, our correspondent says.
Thousands of people have marched in Warsaw, protesting against Poland's conservative government, 27 years since the fall of communism.