Pakistan security sources said they had freed 155 hostages from around 450 passengers while 27 militants were killed.