Frontier Crimes Regulation Commissioner Sahibzada Mohammad Anees ruled that a judge in the tribal belt had exceeded his authority when he handed down the sentence last year and ordered a fresh trial.
Anees also handed over Afridi's case to the political agent of Khyber Agency. He said Afridi could be released only on the orders of the political agent.
Afridi, in his forties, was sentenced to 33 years in jail on May 24, 2012 on a charge of aiding the banned Lashkar-e-Islam terrorist group. The verdict was issued by the assistant political agent, who has judicial powers.
He was also accused of conducting a fake vaccination campaign on behalf of the CIA in Abbottabad as part of efforts to trace bin Laden.
The al Qaeda chief was killed in a unilateral US military raid in the garrison town in May 2011, sending bilateral relations into a tailspin and embarrassing Pakistan's powerful military.
A tribal court in the semi-autonomous Khyber Agency had sentenced Afridi, who is currently being held at the central prison in Peshawar. Legal experts and rights activists had challenged the verdict.
The United States has been pressuring Pakistan to release Afridi and the matter is said to have been raised during Secretary of State John Kerry's recent visit to Islamabad. The US had also withheld aid worth $33 million -- one million for each year in Afridi's prison term -- after he was sentenced.
When terror bosses turn into accountants, motivational speakers!
22 militants, 6 soldiers killed in Pak clashes
Centre rejects Maharashtra's proposal to ban Abhinav Bharat
Saeed will challenge India and GET AWAY with it
'BJP interested in electoral gain and not Ram mandir'