In his first visit to the General Headquarters in the garrison city of Rawalpindi since he assumed office in June, Sharif laid a wreath at the Martyrs Monument and held a one-on-one meeting with outgoing army chief Gen Ashfaq Parvez Kayani.
Soldiers had set an example by sacrificing their "today for ensuring a better tomorrow for our future generations", he said.
"It is this passion and high morale that is the biggest strength of our forces. Those who have laid their lives in the fight against terrorism would be remembered forever," he said.
Following his meeting with Kayani, Sharif was briefed on internal and external threats facing Pakistan. The detailed briefing was also attended by Kayani, Sharif's Special Assistant Tariq Fatemi, Interior Minister Chaudhry Nisar Ali Khan and Finance Minister Ishaq Dar.
Kayani and his Principal Staff Officers briefed Sharif on the spectrum of threats, the operational environment, national security issues, and the army's support to the civilian administration in law and order situations and natural calamities, said a statement from the premier's office.