Officials said some of the freed men were "dangerous" insurgents, including an inmate on death row for trying to kill ex-President Pervez Musharraf.
The jail is located in Bannu, a town in Khyber Pakhtunkhwa, which borders Pakistan's volatile tribal areas.
Pakistan's Taliban said they carried out the attack, but the claim has not been verified.
"We have freed hundreds of our comrades in Bannu in this attack. Several of our people have reached their destinations, others are on their way," a Taliban spokesman told Reuters news agency.
Senior Bannu police official Iftikhar Khan told Agence France-Presse that three police officers were wounded in the two-hour attack.
Officials described how militants in cars and pick-up trucks entered the complex shooting and throwing grenades.
A total of 381 inmates were released out of nearly 1,000 in the prison, they said.
At least 20 of the prisoners were described as "very dangerous".
Police say they include Adnan Rashid, a former member of the air force sentenced to death for an attack on Mr Musharraf.
The BBC's Aleem Maqbool in Islamabad says the attack is clearly a setback for Pakistan's security forces, who over the last year have gained considerable ground against militants in the north-west of the country.
The Taliban carried out an audacious jail raid near Kandahar in Afghanistan in April last year, freeing at least 470 prisoners, including Taliban commanders and fighters.