Sharif told foreign ministry officials here that he was sad over the incidents involving Pakistani and Indian troops along the Line of Control (LoC) that divides Jammu and Kashmir between the two countries.
"The prime minister said it was imperative for both India and Pakistan to take effective steps to ensure and restore ceasefire on the LoC," a foreign ministry statement quoted him as saying.
Sharif's comments came as Indian Defence Minister A.K. Antony earlier in the day formally accused the Pakistan Army of killing the five soldiers in Indian territory early Tuesday.
Antony's previous statement blaming "heavily armed terrorists" and others in Pakistani military uniform led to a storm, with the opposition accusing him of trying to take away the blame from the Pakistan Army.
Without referring to the death of the Indian soldiers, the statement said the clashes -- two Pakistani soldiers were later wounded by Indians -- had flared up tensions between India and Pakistan leading to "loss of precious human lives".
Sharif, who took power in June, emphasised that existing military-to-military channels could be more optimally used to prevent misunderstanding between the two neighbours.
The present crisis, he said, should not be allowed to escalate.
"Pakistan ... is prepared to discuss steps with India for further strengthening of existing mechanisms both at the political and military levels," the statement quoted him as saying.
This is the first major diplomatic crisis Sharif is facing -- and it comes ahead of a planned meeting between him and his Indian counterpart Manmohan Singh on the sidelines of the UN General Assembly in September.
Sharif said it was incumbent upon the leaders of India and Pakistan "not to allow the situation to drift and to take steps to improve the atmosphere by engaging constructively with a view to building trust and confidence".
He said he looked forward to his meeting with Manmohan Singh in New York, where he hoped to "discuss steps to further build trust and consolidate this relationship".
The prime minister reiterated Pakistan's resolve to persist in its efforts to improve relations with India "through a constructive dialogue on all issues".
Those present at Sharif's meeting included Information Minister Pervez Rashid and Advisor to the prime minister on National Security Sartaj Aziz.
The Tuesday killings of Indian soldiers and the wounding of a sixth have led to calls in India that further talks with Pakistan must be called off.