Opener Ahmed Shehzad blasted a 123-ball 103 to set the foundation for a record chase but it was Shahid Afridi's blistering 59 off 25 balls which helped Pakistan set up a summit clash against Sri Lanka.
With this victory, Pakistan grabbed four points to aggregate 13 with the help of three victories in four matches. India, on the other hand, are currently with four points and even a win against Afghanistan tomorrow won't be enough for Virat Kohli's men to reach the finals.
Mohammad Hafeez (52) and Fawad Alam (74) too blasted scintillating half-centuries to help Pakistan overhaul Bangladesh's record score of 326 for 3 in their stipulated 50 overs at the Shere Bangla National Stadium here.
For Bangladesh, Mominul Haque (2/37) was the highest wicket taker, while Shakib Al Hasan, Abdur Razzak and Mahmudullah scalped one each.
Earlier, Bangladesh feasted on a below bowling and fielding effort from Pakistan to pile up their highest-ever ODI total of 326 for three.
While opener Anamul Haque build the foundation with a patient 100 off 132 balls with six fours and four sixes, it was their senior-most stars Mushfiqur Rahim (51 no, 33 balls) and Shakib al Hasan (44 no, 16 balls), who finished the innings with a smashing 77-run partnership in only 5.3 overs.
Opener Imrul Kayes (59 from 75 balls; 5x4, 2x6) who added 150 runs for the opening stand with Anamul and Mominul Haque (51 off 47 balls) also made useful contributions to prop up Bangladesh total.
Chasing a mammoth 327 to win, Shehzad laid the foundation with his fifth ODI century as the elegant righthander put on 97 run with Mohammad Hafeez (52) for the opening wicket.
Shehzad started patiently giving Hafeez the most of the strikes as the Pakistani allrounder cruised to his 20th ODI halfcentury from 43 balls.
Pakistan lost the key wickets of Hafeez and skipper Misbah-ul-Haq, who was bowled by Shakib in successive overs, but Shehzad ensured that they did not lose momentum as he put on another crucial partnership of 105 with Fawad Alam.
Shehzad stepped up the gear scoring 60 runs from 44 balls to notch his fifth ODI century.
After Shehzad's departure, Afridi took the onus on him and whacked seven sixes and two fours to keep Pakistan in the hunt. He came at a time when the required run-rate had jumped to 12 and the inspirational allrounder did everything right cruising to his third 18-ball 50, and 36th overall in ODIs.
Even the luck factor had favoured Afridi when he got a reprieve on 52 when Bangladeshi skipper Mushfiqur dropped a skier. It was in the same score a Shakib delivery did not dislodge the bail after kissing Afridi's leg stump.
In the end, Shakib brought on Afridi's fall with a direct hit runout from midoff as the Sher-e-Bangla National Cricket Stadium crowd had the biggest cheer.
After his fall, Fawad Alam (74) took them near to the target only to be run out with two runs required of as many balls. Umar Akmal (10 not out) then struck a winning boundary and seal the chase with one ball to spare.
Earlier, it was Bangladesh's premier allrounder Shakib's innings which helped them to score 68 runs in the last five overs and eclipse their previous best score of 320/8 against Zimbabwe during their tour of 2009.
Returning from a three-match suspension, Shakib blasted six fours and two sixes in his 16-ball innings, while skipper Rahim also struck eight fours and Mominul with six boundaries also made their presence felt with eye-catching knocks.
Nothing went Pakistan's way in the match. From spilling a catch at slip when Kayes was on zero in the first over to a some woeful misfieldings that had Misbah-ul-Haq dumbfounded, Pakistan looked disjointed and disoriented right from the start.
The worst came for Pakistan when their left-arm spinner Abdur Rehman who was included in place of left-arm pacer Junaid Khan was barred from bowling after bowling a hat-trick of 'beamers' with unprecedented figures of 0-0-8-0.
Another thing that baffled many was the team's decision to take out the ace spinner Saeed Ajmal after his brilliant first spell of three overs that conceded only four runs.
Ajmal once again looked the best bowler of the day during the first part before he gave away 52 runs in his final four overs.
Surprisingly, when it was needed to break the century-plus opening partnership, Pakistani skipper Misbah-ul-Haq chose to keep the ace off-spinner out of the attack as the duo of Kayes and Haque cruised to 101 runs in 18 overs.
The duo put on 150 runs in 28.2 overs, Bangladesh's second highest opening partnership after the 170 by Shahriar Hossain and Mehrab Hossain against Zimbabwe in 1999 as Mohammad Talha broke the stand taking the wicket of Kayes.
Ajmal was brought on finally in the 36th over to complete his quota as he dismissed Haque with a deceiving doosra immediately after scoring his second ODI century.
Haque stepped out to Ajmal immediately after getting to three figures but was holed out at deep midwicket.