"We proudly announce the liberation of Derna, a city dear to all Libyans," the breakaway military leader said in a televised speech.
He promised residents a "new era of freedom, security and peace".
A spokesman for Haftar's self-styled Libyan National Army (LNA) said troops stormed the last stronghold of the "al-Quaeda organization" in the city center.
The LNA launched its offensive on May 7 to seize the city, a coastal town of nearly 150,000 people, about 1,000 kilometers (620 miles) east of Tripoli.
Derna had been held by a ragtag alliance of Islamist and jihadist militias, including groups close to Al-Qaeda hostile to both Haftar and the Islamic State group.
Accused by his opponents of wanting to establish a new military dictatorship in Libya, Haftar supports a parallel government that rules over eastern Libya and challenges the authority of the UN-backed government based in Tripoli in the west.
The LNA said earlier this week it had regained "full control" of Libya's oil crescent, days after it retook Ras Lanuf and Al-Sidra – through which Libyan oil is transported abroad – from a rival militia in nearly two weeks of deadly clashes.
Haftar said all future revenues from the terminals under his control would be handed over to the unrecognized administration.
Washington and its allies on Wednesday, June 27, demanded that the two key oil installations be returned to the control of the UN-backed government, who called on the UN Security Council to block any "illegal" oil exports from the chaos-hit country.
Libya has been wracked by conflict since the 2011 ouster and killing of longtime dictator Moamer Kadhafi in a NATO-backed uprising, with rival governments and militias competing for authority and oil wealth.
Its economy relies heavily on oil, with production at 1.6 million barrels per day under Kadhafi.
Kadhafi's 2011 ouster saw production fall to about 20% of that level, before recovering to more than one million barrels per day by the end of 2017. – Rappler.com