The protesters have taken to the streets of Islamabad for five days, led by cricket star turned opposition leader Imran Khan and cleric Tahir ul-Qadri, who runs a network of Islamic schools and charities.
Both want Sharif to resign over allegations of corruption and election rigging. The Supreme Court summoned both to appear before the court on Thursday.
The peaceful protests have raised questions over the stability of the nuclear-armed nation of 180 million people. Its civilian government is struggling to assert its authority after decades when the country swung between democracy and military rule.
The coup-prone South Asian nation is also plagued by high unemployment, daily power cuts and a Taliban insurgency. Anti-Western and violent sectarian groups are gaining strength.
Most protesters say they are demonstrating against government corruption, which they blame for the country's widespread poverty.
On Tuesday night, protesters used cranes and bolt cutters to dismantle police barricades and surround parliament. On Wednesday, Qadri urged the crowd to barricade lawmakers and the prime minister inside as they met to discuss the crisis.
"Don't let all those inside come out and don't let anyone go in," he told supporters.
His exhausted followers, some carrying blankets or colourful umbrellas, were resting in the shade on the grass on Constitution Avenue when he spoke. But they immediately rose to block the entrance to parliament.
Riot police and paramilitary forces in the area did not intervene and Qadri urged the crowd to remain peaceful.
"If you and the army come face to face, don't raise your hand. If you do, you will not be welcome amongst us," Qadri said.
Legislators left parliament by a back entrance. Lawmaker Marvi Memon, from the ruling party, said every parliamentarian present had denounced the protests and offered support to the government.
"This affront to parliamentary democracy has been noted," she said. "This is only a handful of people and they do not represent the will of the people."
Parliament would reconvene on Thursday, she said.
But Khan has given Sharif until 8 p.m. (1500 GMT) on Wednesday to resign or face an invasion of protesters at the prime minister's official residence.
"Now no police nor army will stop us," he told supporters on Tuesday. If Sharif did not step down, he said, "we will come to the prime minister's house".
The military, which often acts as an arbiter when it is not ruling directly, has called for a political solution to the crisis.
"Situation requires patience, wisdom and sagacity from all stakeholders to resolve prevailing impasse through meaningful dialogue in larger national and public interest," military spokesman General Asim Bajwa tweeted as the protesters approached parliament.
Last month, the civilian government made the military officially responsible for the security of top government offices. All the protesters have been careful not to offend the military, which is Pakistan's most powerful institution.
The country's other two power centres are the embattled civilian government and the activist judiciary, which waded into the fray on Wednesday when Chief Justice Nasir ul-Mulk summoned Khan and Qadri to appear on Thursday over a petition filed against their protests.
Pakistan's top courts can declare an interest in any case or accept and investigate a complaint from any petitioner. They can also charge those who question their decisions with contempt of court.
Khan wants Sharif to step down because he believes the prime minister rigged last year's polls. Sharif won the election by a landslide, taking 190 out of 342 seats in the national assembly.
The polls were the first democratic transfer of power in Pakistan's history and also propelled Khan from a fringe player to head of the third-largest legislative bloc in the country.
Qadri wants Sharif to step down because he says the system is corrupt. He has promised free housing for the homeless, and welfare and subsidised food and electricity for the poor.