Who weakened the Mughals? the Afghans. Mughals did everything to avoid conflict.
Ahmad Shah began his rule by capturing Ghazni from the Ghilzais, and then wresting Kabul from the local ruler. In 1749, the Mughal ruler was induced to cede Sindh, the Punjab region and the important trans Indus River to Ahmad Shah in order to save his capital from Afghan attack. Having thus gained substantial territories to the east without a fight, Ahmad Shah turned westward to take possession of Herat, which was ruled by Nader Shah's grandson, Shah Rukh of Persia. Herat fell to Ahmad after almost a year of siege and bloody conflict, as did Mashhad (in present-day Iran). Ahmad Shah next sent an army to subdue the areas north of the Hindu Kush mountains. In short order, the powerful army brought under its control the Turkmen, Uzbek, Tajik and Hazaras tribes of northern Afghanistan. Ahmad invaded the remnants of the Mughal Empire a third time, and then a fourth, consolidating control over the Punjab and Kashmir regions. Then, early in 1757, he sacked Delhi, but permitted the Mughal dynasty to remain in nominal control of the city as long as the ruler acknowledged Ahmad Shah's suzerainty over Punjab, Sindh, and Kashmir. Leaving his second son Timur Shah to safeguard his interests, Ahmad Shah left India to return to Afghanistan.
The past is the past. Pakistan cannot afford an open border with Afghanistan. Period.