The brazen assault on the symbolic center of power, along with territorial gains elsewhere, highlight how NATO-trained Afghan security forces are struggling to cope with worsening violence, Reuters reported.
The terrorists are pushing to take territory more than 13 years after US-led military intervention toppled them from power.
Monday's attack, in which at least 19 people were wounded, began as lawmakers met with the new acting defense minister, Masoom Stanikzai, the third candidate so far for the key security post whose appointment must be confirmed by parliament.
A Taliban terrorist detonated a car loaded with explosives outside parliament gates, said Ebadullah Karimi, spokesman for Kabul police, raising questions about how the driver got through several security checkpoints.
Six gunmen took up positions in a building near parliament, he said, but never breached the compound's gates. Security forces killed the six after a gun battle lasting nearly two hours.
Kabul police chief Abdul Rahman Rahimi said all lawmakers were safe. TV pictures showed the speaker sitting calmly and legislators leaving the building, engulfed in dust and smoke, without panicking.
Taliban spokesman Zabihullah Mujahid claimed responsibility.
"We have launched an attack on parliament as there was an important gathering to introduce the country's defense minister," he said by phone, referring to Stanikzai.
Farhad Sediqi was one of several lawmakers who criticized security agencies for not preventing the attack.
"It shows a big failure in the intelligence and security departments of the government," he said.
In 2013 the presidential palace was hit, and the US embassy has been attacked several times, notably in 2011 when nine people were killed and 27 wounded in coordinated strikes on the embassy and other targets.
A district in the northern province of Kunduz fell to the Taliban on Monday, the second such loss in two days. Officials said the terrorists were able to take over when urgently needed reinforcements failed to arrive.
The Taliban captured Dasht-e-Archi district a day after hundreds of terrorists fought their way to the center of the adjacent district of Chardara.