When subcontinent was divided in 1947, Pakistan and India were born. At that time US was one of the first countries to recognize Pakistan. After independence America established the embassy in the early years of Pakistan birth. Pakistan also aligned itself with the USA during the cold war. When Afghanistan was invaded by USSR, Pakistan was at the forefront of the war. There was a time Pakistan was termed as Non-NATO ally of the USA.
Firstly, Well the American stance changed the moment Pakistan decided not to play an effective role in the Afghan war directly. The Americans thought that they can win the Afghan war without Pakistan's help. Pakistan pulled out of the Afghan war because it realized that it was a useless act. Secondly, terrorism was increasing rapidly inside Pakistan due to this. Pakistan did the right thing. The Americans thought that by making India a key player in the Afghan crisis the importance of Pakistan would decrease but they were wrong. What I believe is that Pakistan is the most important player in the Afghan peace process. Even more important than the US itself. But the Americans have failed to understand this and that's is why America is losing ground in Afghanistan even though they are pouring billions of dollars, making this war one of the highly expensive wars.
Secondly, the American wants to nullify the effect of China in the South Asia region. Especially after the start of CPEC. The Americans believe that through CPEC China would take control of Pakistan and other adjoining regions. So through the triangle of America India and Japan, it can nullify China growing importance in the region.
Maybe America became successful in this policy in the future but till now this policy hasn't been very successful. I believe China has already started showing signs of an emerging superpower, especially in the disputed Island dilemma.
In light of the above discussion, America has distanced itself from Pakistan due to many reasons. But the major reasons are CPEC and Pakistan refusal to take part directly in the war.