Thousands of anti-government protesters have tried to raid the official residence of Pakistan's prime minister, sparking clashes with police that killed three people and wounded nearly 400 amid cries for the premier to step down, officials said.

The overnight violence has raised the stakes in the two-week sit-in led by opposition politician Imran Khan and fiery cleric Tahir-ul-Qadri, which earlier saw demonstrators march past roadblocks to set up camp outside of Pakistan's parliament.

They demand Prime Minister Nawaz Sharif step down over their allegations of massive voting fraud in the election that brought him into office last year in the country's first democratic transfer of power.

Backed by parliament and many political parties, Mr Sharif has refused to step down as negotiators have tried to convince Mr Qadri and Mr Khan to end their protests.

Late Saturday night, protesters headed toward the prime minister's residence. When the crowd started removing shipping containers used as barricades, police fired salvos of tear gas that forced the crowds back. Authorities have said they had no choice but to use force.

Scores of protesters carrying hammers and iron rods also broke down a fence outside of parliament late yesterday, enabling hundreds of people to enter the lawns and parking area. Islamabad police chief Khalid Khattak said the protesters were armed with large hammers, wire cutters, axes and even a crane.

The protesters started regrouping at daybreak today and made repeated attempts to make their way through heavy deployment of police and barricades to reach the premier's residence. Police strengthened their lines and responded by lobbing tear gas canisters.

Nearly 400 people - including women, children and police officers - were admitted to local hospitals, officials said. The injured had wounds from tear gas shells, batons and rubber bullets, said Dr Javed Akram, who heads the capital's main hospital.

One person drowned in a ditch after he was in a crowd bombarded with tear gas while two others died from wounds related to rubber bullets, said Dr Wasim Khawaja, a senior official at the hospital.

Police also beat local journalists covering the protests with batons, injuring some, railways minister Saad Rafiq said. Mr Rafiq said he intervened to stop the police assault and said that he would ask the government to investigate the officers' conduct.

The protests began with a march from the eastern city of Lahore on Pakistan's Independence Day on August 14. Mr Khan and Mr Qadri had called for millions of protesters to join, but crowds have not been more than tens of thousands.

The protesters' presence and heightened security measures have ground life in much of the capital to a halt.

Both Mr Khan and Mr Qadri stayed overnight at the protests, spending most of their time in the containers that they have been living in for days.

Mr Khan called for demonstrations across Pakistan and described the police actions against the crowd as illegal. Mr Qadri said he had been up all night praying and monitoring the situation.

"If they think their brutality will force us back, they are wrong," he said in a choked voice.

The demonstrations signify the starkest threat to Mr Sharif's third term as prime minister. His previous term ended with a military coup and his eventual exile. This turn in office has seen equally contentious relations with the country's powerful army.

He has clashed with the military over the prosecution of the former army chief for treason, accusations the country's powerful spy agency was behind the attempted killing of a top TV anchor, and a military operation in the tribal areas.

Mr Sharif vowed he would not step down, but if the violence continues it could severely undermine his authority.