* Macedonia sealed border Thursday, rationed entry

* Migrants stormed through police lines on Saturday

* State laying on extra trains, buses carrying migrants north

* Over 5,000 enter Serbia on Sunday (Recasts with Serbia arrivals)

By Fatos Bytyci

GEVGELIJA, Macedonia, Aug 23 (Reuters) - More than 5,000 migrants crossed into Serbia on Sunday, resuming a journey to western Europe after an overwhelmed Macedonia gave up its attempts to stem the flow of mainly Syrian refugees by force.

Macedonia laid on buses and trains to carry them north after days of havoc caused by the closure of its southern frontier by security forces, who used stun grenades and tear gas in an attempt to keep them out.

The flow was unabated, as Greece ferried refugees from inundated islands to the mainland. A record 50,000 hit Greek land by boat from Turkey in July alone, bringing ripples of Middle Eastern conflicts to Europe's shores.

Serbian Defence Minister Bratislav Gasic, visiting a migrant reception centre on Serbia's southern border with Macedonia, said more than 5,000 people had entered overnight as Macedonia cleared the backlog.

Huge queues formed as migrants from the Middle East, Africa and Asia waited for papers to legalise their transit north through Serbia, before they cross by foot into Hungary and Europe's borderless Schengen zone.

Many had slept in the open on the Greek-Macedonian border with little access to food or water.

"We expect the wave in the next day or two to be of a similar intensity," Gasic was quoted as saying by the Serbian state news agency, Tanjug. "Police are working in three shifts, papers are being issued around the clock."

People smugglers have thrived this summer on a surge of people fleeing war and poverty which has overwhelmed authorities from the Greek islands to the French port of Calais.

Many undertake dangerous journeys across sea and then cross southern Europe in order to reach wealthier nations like Germany, where officials expect a record 750,000 asylum-seekers to arrive this year.

In Greece, a car ferry carrying 2,466 migrants from Greek islands, most of them fleeing Syria, docked in Athens on Sunday morning. It left again two hours later to pick up more. Almost all will head to Macedonia.

Serbia appeared better equipped than Macedonia to handle the surge in numbers, having recently opened the reception centre in the southern town of Presevo.

Macedonia declared a state of emergency on Thursday and sealed its southern frontier to migrants pouring in at a rate of 2,000 per day. The numbers had overwhelmed the main border railway station and the conservative government, which has a tense relationship with Greece, said enough was enough.

That led to desperate scenes at the border before crowds finally tore through police lines on Saturday.

"I watched the news on TV and I was astonished," said Abdullah Bilal, 41, from the devastated Syrian city of Aleppo.

"I thought I would face the same when I arrive here. But it was very peaceful. The Macedonian police told us 'Welcome to Macedonia; trains and buses are waiting for you.'"

Mohannad Albayati, 35, from Damascus, travelling with his wife, two children and three brothers, said: "I passed one step but it is a long road to my destination. With Allah's help I will go to Germany."

In Germany, there were scuffles between protesters and police outside a refugee shelter in the eastern town of Heidenau for a second night. (Additional reporting by Reuters Television, Matt Robinson in BELGRADE and Greg Roumeliotis in ATHENS; Writing by Matt Robinson; Editing by Jon Boyle)