Chasing 303, Pakistan slipped to 77-3 before Sarfraz Ahmed (90) and Shoaib Malik (77) shared 163.
Despite a late wobble, the tourists got home with 10 balls to spare.
England's 302-9 came via 87 from Jason Roy and Ben Stokes' 75, but they took only 42 runs off the last eight overs in a slide of five wickets for 64.
They were stifled by some impressive pace bowling from Hasan Ali, who took 4-60, and Mohammad Amir (3-50).
Eoin Morgan's men also gifted wickets as a result of their desire to attack whatever the situation - a new approach to one-day cricket that has brought a dramatic improvement and spectacular results since the 2015 World Cup, including the record-breaking total of 444-3 in the third ODI.
England end the series as 4-1 winners, missing out on a first 5-0 home whitewash, and complete their summer with a T20 at Old Trafford on Wednesday.
Sarfraz and Shoaib salvage Pakistan pride
Pakistan, outplayed throughout the series, were firmly on the back foot when the extra pace of Mark Wood bowled Babar Azam and had Azhar Ali caught behind in the same over.
But Sarfraz and Malik combined to compile the highest Pakistan fourth-wicket partnership in an ODI against England.
When on nine, Malik offered a difficult chance to a diving Joe Root at short cover but, apart from that, the England attack had few answers.
Sarfraz, favouring the leg side, dished out some particularly brutal treatment to debutant left-arm spinner Liam Dawson.
Malik played the supporting role, but followed Sarfraz in needlessly holing out off Dawson and, when a Jonny Bairstow direct hit ran out Mohammad Nawaz, Pakistan had lost three wickets for 26 runs.
With 37 still required, Mohammad Rizwan and Wales-born Imad Wasim absorbed the pressure and ensured there was no further drama, delighting a large contingent of raucous Pakistan supporters in the crowd.
Rest and rotation leaves England short
England once again shuffled their side, leaving out spinners Adil Rashid and Moeen Ali partly because of the grey conditions in Cardiff and also to look at Hampshire's Dawson before the winter tours to Bangladesh and India.
If the amount of turn in the surface showed selecting only one spinner to be a mistake - Pakistan left-armer Imad was particularly effective for figures of 1-33 - then the visiting batsmen ensured Dawson endured a mixed debut.
Sarfraz swept and used his feet to hit through the leg side, while Malik lofted two huge sixes.
Although Dawson would eventually remove both men, he and the recalled Chris Jordan went for a combined 122 from 15.2 overs.
Loss of momentum costs England
Still, it was posting a score that was no more than par that ultimately led to England's defeat.
While Roy sparkled off his pads and down the ground, and Stokes peppered the boundary after a slow start - the first 32 deliveries of his 76-ball stay yielded only 12 runs - the imposing total that looked likely at 170-4 from 30 overs did not materialise.
Bairstow pulled Umar Gul to deep square leg, Stokes lapped Hasan to short fine leg, Chris Woakes played on off the same bowler, Dawson miscued Amir to mid-wicket and David Willey was caught in the deep on the leg side.
With Hasan and Amir cleverly bowling the ball into the pitch, England were left to bat out the overs, falling short of a score good enough to complete the clean sweep.
'No regrets' - what they said
England captain Eoin Morgan: "There are no regrets - it was an opportunity to get Liam Dawson onto the international stage. It was important looking ahead to the winter in case we go to three spinners. I'm very proud of this group of players, they've been exceptional over the summer."
Man of the series Joe Root: "We've still got areas where we can improve going into this winter and then the Champions Trophy. You want the guys to go out, express themselves and play their natural way. The more they can do that, the better."
Pakistan skipper Azhar Ali: "We wanted to finish on a high, we've had a tough tour. We didn't bowl well to start with but we held it back to a total that was reachable. There are a lot of positive signs, we just need to play good cricket consistently."