Asghar Stanikzai and Samiullah Shenwari rescued the war-torn nation from a precarious 90 for five with a 164-run stand to take Afghanistan to 254 for six wickets.
Stanikzai (90 not out) and Shenwari (81) batted cautiously to steady the innings before adding 107 runs in the last 10 overs for Afghanistan, who have qualified for next year's 50-over World Cup in Australia and New Zealand.
The partnership was finally broken when Shenwari was run out on the penultimate delivery of the innings.
Bangladesh lost both their opening batsmen in the first two overs and then saw a flurry of wickets fall in the middle of their innings to be all out for 222 in the 48th over.
A half century to Mominul Haque and Ziaur Rahman's 41 off 22 balls took the hosts past the 200-run mark after they were reduced from 161 for four to 165 for eight in less than two overs.
Afghanistan, who were playing their fourth one-day international against a full member, are making their Asia Cup debut with India, Pakistan and Sri Lanka also taking part.