Sources from Helmand said the Taliban's group attack on 215 Maiwand Corps in the southern province ended on Saturday at around 4pm Kabul time.
According to the sources, the attack has left at least 50 dead and more than 40 wounded.
The attack on the military base which is located at Camp Shorab in Helmand started at around 2am on Friday.
Some attackers had hidden at one corner of the military base inside armored vehicles which delayed the clearance operation, sources said.
The Ministry of Defense on Friday evening announced that the attack ended after 16 hours.
The ministry said 23 security force members were killed and 16 others were wounded in the clashes.
At least 20 militants, including eight suicide bombers, were killed in the attack, the ministry said in a statement.
Taliban claimed responsibility for the attack.