Both incidents occurred in Pakistan's northwestern Khyber-Pakhtunkhwa province
Pakistan has summoned diplomats from Afghanistan and India after several shooting incidents along two different borders killed four Pakistani soldiers and a civilian woman.
Accusations of firing by both sides across the Afghan-Pakistani border, and by both Indian and Pakistani forces across an old ceasefire line dividing their areas in the Muslim-majority region of Kashmir are common.
The latest incidents come at an especially tense time between Pakistan and India, and as talks between the United States and the Afghan Taliban have broken down.
Pakistan's Foreign Office summoned an Afghan diplomat on Saturday to account for what it said was firing into Pakistan by militants in Afghanistan, a spokesman for Pakistan's foreign ministry said in a statement.
The militants shot and killed a Pakistani soldier on patrol in one incident late on Friday. In a second incident, Pakistani forces fencing a section of the border were attacked and three were killed, the ministry said on Saturday.
Both incidents occurred in Pakistan's northwestern Khyber-Pakhtunkhwa province.
Pakistan underscored in its meeting with the Afghan diplomat that Afghanistan was responsible for securing its side of the border.
An Afghan government spokesman could not be immediately reached. Afghan officials have in recent weeks accused the Pakistani military of several incidents of heavy artillery fire into Afghanistan.
Both of the uneasy neighbours are battling militant factions along their largely porous border and each accuses the other of harbouring their militant enemies.
Pakistan also summoned an Indian diplomat on Saturday after it said firing by Indian forces across the Line of Control (LoC) in the disputed territory of Kashmir killed a 40-year-old woman from the village of Balakot.
The nuclear-armed neighbours have fought two of their three wars over Kashmir.
The LoC, an old ceasefire line, is the de facto border between the parts of Kashmir that India and Pakistan administer.
Tensions between the two countries have flared since Aug. 5 when New Delhi flooded Indian Kashmir with troops to quell unrest after it revoked the region's special status.
Pakistan foreign affairs spokesman Mohammad Faisal said in a statement on Saturday that India deliberately targets civilian areas. A spokesman for India's external affairs ministry could not be immediately reached.
India has long accused Pakistan of supporting militant groups fighting Indian security forces in its part of Kashmir. Pakistan denies that.