About 2,000 angry Sunnis gathered outside a hospital where victims of the explosions in the city of Multan were taken, shouting "Shiites are infidels!" and slogans against the government, witnesses said.
The bombings came less than a week after a suicide attack left 31 dead at a Shiite mosque in an eastern city.
About 3,000 people had gathered in a residential area of Multan to mark the anniversary of the death of the leader of the outlawed Sunni radical group Sipah-e-Sahaba killed in an attack last year.
A car bomb exploded near the venue as people were starting to disperse after the overnight meeting, and two minutes later a second bomb attached to a motorcycle went off, deputy city police chief Arshad Hameed said.
"It seems to be an act of sectarian terrorism, but we are still investigating," he told The Associated Press.
Officials at the Nishtar government hospital said at least 39 people were killed and more than 100 were wounded, about 50 seriously. Some 50 others were treated for minor injuries and later discharged. Other people were taken to other clinics.
Pools of blood and shoes of the victims were scattered at the scene, near the charred remains of the car.
Jamil Usmani, 26, who had been standing in a nearby parking lot with friends, said a stampede after the bombing caused many injuries.
"The explosion numbed our ears, we saw people falling on each other, everybody was crying, everybody was running," he said. "Many people were injured in the stampede, we started picking them up and asked passing cars for help."
Interior Minister Aftab Khan Sherpao said it was a remote-controlled bomb planted inside a Suzuki car. Police estimated it weighed about 15 pounds, and said most injuries were caused by flying metal from the vehicle.
It did not appear to be a suicide attack because no body parts were found inside the car, Multan police chief Sikander Hayyat told the private Geo television network.
Witnesses said the Sunni protesters who gathered outside the Nishtar hospital attacked two ambulances, shattering the windscreens with sticks. Nearby, others burned tires, casting a pall of black smoke.
Inside the hospital, bloodied victims were crammed into an emergency ward, some lying two to a bed. The dozens of dead were placed side-by-side on the floor of another ward.
Officials said about 1,000 police, including reservists, were called from other districts, and soldiers were patrolling the city to stop Sunni and Shiites from clashing. Multan has suffered sectarian violence in the past.
Sunni Muslims make up about 80 percent of the 150 million people in Pakistan, and most of the rest are Shiites. The vast majority of both sects live in harmony but radical elements on both sides carry out attacks.
"We condemn this terrorist attack. This is tragic," Information Minister Sheikh Rashid Ahmed told AP in the capital, Islamabad. "The government will continue its mission against terrorism."
The bombing happened around 4:40 a.m. as the gathering was dispersing after prayers for the soul of Sipah-e-Sahaba leader Maulana Azam Tariq, who was gunned down on the outskirts of Islamabad last year — an attack blamed on Shiite Muslim militants.
A leader of the group blamed Thursday's bombings on radical Shiite Muslims.
"This is the worst kind of terrorism, and everybody knows who is behind it," said Ahmad Ludhianvi, the head of Sipah-e-Sahaba.
He urged calm among supporters of the group, but accused the government of negligence and demanded the arrests of the attackers within a week.
"We are peaceful but there will be no guarantee for peace after one week if those who have killed our people are not arrested," Ludhianvi told 5,000 mourners at a mass funeral for 31 victims held Thursday afternoon.
Pakistan, a key ally in the U.S.-led war on terrorism, has suffered a spate of terrorist attacks in recent years, and has a history of sectarian violence.
Thursday's blasts came six days after a suicide attacker detonated a bomb inside a crowded Shiite mosque in the eastern city of Sialkot during Friday prayers, killing 31 people and injuring more than 50.
The attack also came hours after the burial of an alleged top al-Qaida operative and Sunni Muslim militant Amjad Hussain Farooqi at a village in eastern Punjab province.
Farooqi was killed in a shootout with security forces Sept. 26 in southern Pakistan. He was a member of Lashkar-e-Jhangvi, a breakaway militant faction of Sipah-e-Sahaba, and had been accused in attacks on Shiites, and in the 2002 kidnapping and beheading of American journalist Daniel Pearl.