The difficulty is that the two countries are pursuing different endgames: the U.S. wants a an independent and prosperous Afghanistan existing under rule-of-law while Pakistan seeks a satellite Afghanistan under the sway of its own pet Talibs; Pakistan remains wedded to the strategy that incubated 9/11.
Thus Pakistan opposes any reconciliation with the Taliban that leads to peace in a Afghanistan absent of Pakistani political domination. As if economic influence wasn't enough! Really, this looks like the product of a military mindset unobstructed by political moderation: dominate or be dominated, etc. Afghanistan's problems are rooted in Pakistan's issues, so the emphasis should be there. Probably the only weak lever the U.S. exercises is to cut off the flow of U.S. "aid" but it seems that Pakistan is both the arsonist and firefighter so the U.S. has been afraid to take that step.
So far.
That is not entirely true. Don't apply such altruistic aspirations to US intentions only. The US is there because it needs to maintain a foothold in the Russian and Chinese backyards. So contrary to oft-stated reason, this is not just about denying space to AQ/ISIS in Afghanistan because that is a Russian/Chinese interest as well and they too can assist Afghans in doing so without having the Americans there. Secondly, how can we make Afghanistan prosperous when a significant proportion of the population see the American presence as meddling in their affairs? The ones who die on the battlefield are Afghans themselves. No amount of Pakistani aid, support can force one to offer their lives unless they believe in what they are doing. So there is a massive issue of foreign boots on Afghan soil. No amount of aid/assistance can resolve that issue no matter what the Kabul based government says.
To the point about Pakistan, the reason Pakistan has a reason to work with Pakhtun aligned Taliban is because of the way the war was executed 2004 onwards. The power center shifted in Afghanistan with the Northern Alliance becoming ascendent. This changed a lot of things for Pakistan. Primarily a border issue which was dormant suddenly became active, putting more pressure on Pakistan to divvy up its meager resources to handle a two front threat. On top of that, Indian presence has only increased, and regardless of how beneficent and harmless it may be, it gives Indians the ability to leverage it against Pakistan. Again the issue is even if the intent to threaten Pakistan from Afghanistan may not be there, that can change overnight. So all in all, Pakistan has legitimate concerns. These are as legitimate as those of Afghans or any others involved. Pakistan would adjust its course if some solid assurances (beyond talk) were given to Pakistan that it need not worry about the threat to it from its western borders.
Keep in mind that America sets red-lines when its core interests are threatened (read existentialist threats). It is doing so with North Korea now for this reason and it has done the same with Iran and in the past with Cuba when the Soviets parked their nuclear weapons a few minutes flying time away from DC. Pakistan's issues with India are of the same nature. America cannot ignore these concerns by expecting Pakistan to sacrifice its security because they have a distant project in Afghanistan to contain China and check Russia.
Pakistan's affinity to Afghanistan and the love that we have for Afghans can never be compared to anything material that the US and India offer because under all this geo-political mess, the people of Pakistan know deep down in their hearts that the Afghans are our brothers no matter how much hatred they may display for some of our policies. We allowed the ravages of war to visit us for Afghans. We suffered through 3 decades of violence, drugs and instability because of Afghanistan. Some say Pakistan should have let the Soviets do what they wanted to, but the vast majority say "it was worth it" despite the pain that the country itself took on. So to us, even if this war lasts 50 years, Pakistanis and Afghans will come together as brothers. Deep down Afghans know that Pakistan wants the best for it. But in a transitory state, we have to watch over our security too. There is so much more that can be written here, but my point is that Pakistan is not the villain here and many of the Afghan people know this.