Jeremy Corbyn has called on the government to recognise the UK's "obligations" to help refugees, at a rally in central London.
In one of his first acts since his election as the new Labour leader Mr Corbyn joined the demonstration in Parliament Square.
Police sources said tens of thousands of people had taken part in the event.
In London, Mr Corbyn urged the government to "open your hearts and open your minds and open your attitude towards supporting people who are desperate, who need somewhere safe to live, want to contribute to our society, and are human beings just like all of us."
He said: "Recognise your obligations in law, that would be good. Recognise your obligations to help people which you're required to do by law, that would be good."
Such an approach was "surely" the "way forward", he added.
There has been a massive increase in the number of people fleeing the Middle East and Africa in recent months. More than 350,000 migrants were detected at the EU's borders between January and August 2015, compared with 280,000 for the whole of 2014.
David Cameron has said the UK will accept 20,000 Syrian refugees by 2020. But the prime minister has also said taking more people was not a simple answer and the UK must help bring stability to the region.
Mr Corbyn - who won a landslide victory in the leadership election - added that those trying to flee to the UK were "victims of war, victims of environmental degradation, victims of poverty and victims of humans rights abuses".
He thanked people in Hungary and Austria for the support shown to migrants, and expressed gratitude for Germany saying it would be willing to help.
"Surely our objective ought to be to find peaceful solutions to the problems of this world, to spend our resources on helping people, not hindering people and to try and bring about that world of decency, humans rights and justice," Mr Corbyn said.
Green Party Leader Natalie Bennett said Mr Cameron should "welcome our fair share of the refugees in Europe".
She called for "an orderly programme" so that people "do not have to put their lives in the hands of smugglers".
Civil rights campaigner Shami Chakrabarti, director of Liberty, told the crowd: "Look at what you've done today, you have come to shame your leaders into representing you and your values.
"Come together to shame your leaders into showing just an ounce of basic human decency."