The 22-year-old left-hander shared a 110-run stand for the third wicket with Kevin Pietersen (63 not out) to give England a memorable win in the day-night game.
England last won a one-day series in the subcontinent in 1986-87 when they beat Pakistan 3-0.
After restricting Sri Lanka to a modest 211-9, England reached the target with 19 balls to spare for an unbeatable 3-1 lead in the five-match series.
"The boys bounced back brilliantly after the defeat in the first one-dayer. Credit to the players, the coaches, everyone worked hard. It is great to win this series," England skipper Paul Collingwood said.
"The conditions were very difficult and the way our bowlers put their batsmen under pressure despite losing the toss, they deserve a special mention."
Sri Lanka owed their total to gritty half centuries by Kumar Sangakkara (69) and Chamara Silva (67). The duo shared a 126-run stand for the fourth wicket to bail the side out after they were tottering at 20-3.
The platform for England's win was laid by disciplined bowling performances from the new-ball pair of Ryan Sidebottom (3-27) and James Anderson (3-33).
"We lost the game in the first 10-15 overs. We did not have any momentum to take us forward," Sri Lankan skipper Mahela Jayawardene said.
"We did not have enough runs on the board. If we had taken a few early wickets, then 220-odd would have been a competitive score but we failed to do that."
England started off their chase confidently despite losing opener Phil Mustard in the sixth over. Mustard (19) hit paceman Lasith Malinga for two fours before offering a tame catch to the bowler in the same over.
Ian Bell (25) was guilty of wasting a good start, offering an easy catch at mid-on to Malinga off leg spinner Kaushal Lokuarachchi.
Pietersen, struggling for runs in the series, finally hit form with his 17th one-day half-century, reached with a six off Lokuarachchi.
Man of the match Cook hit six fours in his 123-ball knock while Pietersen struck four fours and six in his 75-ball innings.
Earlier, the 29-year-old Sangakkara and Silva batted sensibly to put the innings back on the rails after the early setbacks.
The wicketkeeper-batsman reached his 41st fifty in one day internationals with a single off Bopara while Silva followed suit before falling to Broad for a 101-ball 67, including five fours.
Silva tried to play an uppercut to a wide bouncer, only for Bopara to take a fine running catch near the third man boundary.
Sangakkara fell to the same combination, with Bopara this time taking the catch near the square-leg fence. His 102-ball innings included four fours.
The last match of the series will be played at the same venue on Saturday.
|U. Tharanga||c Shah b Sidebottom||4|
|S. Jayasuriya||c Pietersen b Anderson||3|
|K. Sangakkara||c Bopara b Broad||69|
|M. Jayawardene||c Broad b Anderson||0|
|C. Silva||c Bopara b Broad||67|
|K. Lokuarachchi||lbw b Collingwood||9|
|T. Dilshan||lbw b Anderson||17|
|J. Mubarak||b Sidebottom||20|
|C. Vaas||c Pietersen b Sidebottom||2|
|D. Fernando||not out||3|
|L. Malinga||not out||3|
|Total||(for nine wickets)||211|
Fall of wickets: 1-7 (Tharanga), 2-16 (Jayasuriya), 3-20 (Jayawardene), 4-146 (Silva), 5-158 (Sangakkara), 6-166 (Lokuarachchi), 7-190 (Dilshan), 8-195 (Vaas), 9-206 (Mubarak).
|A. Cook||b Fernando||80|
|P. Mustard||c and b Malinga||19|
|I. Bell||c Malinga b Lokuarachchi||25|
|K. Pietersen||not out||63|
|P. Collingwood||lbw b Fernando||0|
|O. Shah||b Malinga||9|
|R. Bopara||not out||1|
|Total||(for five wickets)||212|
Fall of wickets: 1-30 (Mustard), 2-84 (Bell), 3-194 (Cook), 4-194 (Collingwood), 5-208 (Shah).
England won by five wickets
Toss: Sri Lanka
Umpires: Rudi Koertzen (RSA) and Tyron Wijewardene (SRI)
TV umpire: Asoka de Silva (SRI)
Match referee: Javagal Srinath (IND)
Next match: In Colombo on Saturday.