Pakistan, needing a win to level the three-match series 1-1, were reduced to 77-5 by the 22nd over after electing to take first strike at the Sher-e-Bangla stadium.
But Nasim and Riaz added 85 valuable runs for the unbroken seventh wicket to give their team a respectable total against the hosts, who had won Friday's opener by 79 runs at the same venue.
Nasim was unbeaten on 77 in only his second international and Riaz struck 51 off 40 balls as Pakistan crossed the 200-run mark on the slow pitch.
Skipper Azhar Ali and Sarfraz Ahmed put on an opening stand of 36 before the top-order crumbled in dramatic fashion.
More From This Section
Seamer Rubel Hossain had Sarfraz caught at slip by Soumya Sarkar off his first delivery, before spinner Arafat Sunny bowled the experienced Mohammad Hafeez for zero in the next over.
Left-arm spinner Shakib Al Hasan removed Ali for 36 through a catch by wicket-keeper Mushfiqur Rahim, and trapped Mohammad Rizwan leg-before for 13.
In between those two dismissals, Nasir Hossain bowled Fawad Alam for a duck to open up the lower order.
Bangladesh were boosted by the return of captain Mashrafe Mortaza, who had missed the opening match due to a one-match ban for his team's slow over-rates at the World Cup.
Mortaza, playing his 150th one-day international, claimed one wicket when he took a return catch to end Sohail's resistence.