Captain Junaid Hafeez and Sepoy Raham were martyred in the attack on Monday.
According to the protest letter handed to the Afghan envoy, the foreign ministry demanded from the Afghan government to bring an end to the use of Afghan soil against Pakistan.
Four Army troops were also injured in the assault on the border post.
At least eight terrorists were killed in the attack and others were injured in retaliatory fire from the Army.
The remaining terrorists withdrew across the border after sustaining casualties, the Army's media wing had said.
"Absence of Afghan writ on Afghan side of the border like many other areas facilitate terrorists to undertake such attempts," said the ISPR.
DG ISPR Major General Asif Ghafoor, in a series of tweets, said Pakistan has done its part and has cleared areas on its side of the border from terrorist presence.
He referred to the martyrdom of the soldiers as the price Pakistan is paying for the security vacuum on the Afghan side of the border.
Elaborating further, he said more efforts and enhanced presence along the border is required by all stakeholders, including establishments of new posts, border fencing and increased patrolling.