Sri Lanka in control after setting 457
Stumps Bangladesh 312 and 67 for no loss (Sarkar 53*, Tamim 13*) need 390 to win against Sri Lanka 494 and 274 for 6 declared (Tharanga 115, Chandimal 50*, Mehedi 2-77)
Scorecard and ball-by-ball details
A sparkling Soumya Sarkar fifty set Bangladesh's fourth innings off apace, but the visitors remained 390 runs adrift, on a pitch expected to become prickly on the final day. That they had as many as 457 to chase was partly thanks to Upul Tharanga, who sailed to his first home Test century in the afternoon session, as well as a conservative declaration from Rangana Herath. At the time of declaration, 125 overs remained in the match, but it is highly unlikely so many will be possible - bad light and rain ate up 12 overs at the tail end of day four.
Having been somewhat watchful in the first session, it was after lunch that Tharanga opened his shoulders. He cracked successive fours off Mustafizur Rahman and then routinely strode down the pitch to meet the spinners. Especially severe was he on errors of length, creaming languid boundaries through midwicket and square leg, though he also used the cut and sweep to good effect. He used up 109 balls to reach his half century; his next 47 runs were studded with five boundaries, and came off 44 deliveries. Tharanga paused briefly on the brink of his century, then immediately began to attack again, launching Shakib Al Hasan over long-on. Two more fours were smoked off Mehedi Hasan next over, before Tharanga was bowled trying to attempt a third - Mehedi tossing the ball bravely up, and beating the batsman in the air.
Mehedi had in fact been among Bangladesh's most impressive bowlers on a difficult day. He claimed two wickets under duress, delivering a good mix of turning balls and straighter ones, with an in-out field in place. Shakib took two wickets as well, but it was Mustafizur Rahman who delivered the most immaculate lines and lengths - in the morning session he had delivered four successive maidens, and he conceded only 24 in his nine overs in the day.
Sri Lanka's declaration did not come until after Dinesh Chandimal got to fifty after tea, but nevertheless, they batted most of the afternoon session like a declaration was imminent. Thanks largely to Tharanga, they had hit 160 runs at 5.16 an over, and happily did they burn four wickets in the pursuit of these quick runs. Sweeps and reverse sweeps against the turn were attempted. Bowlers often had batsmen running down the pitch at them. For the first time there appeared to be substantial purchase off this pitch as well, so the contest between bat and ball was roughly even. If Bangladesh had held chances off Dinesh Chandimal, who was dropped on 11, or Dimuth Karunaratne, who was dropped on seven, they may have been more successful in slowing Sri Lanka's advance.
Sri Lanka, though, were themselves unsatisfied with a lead of 350 - though no team had ever scored more than 300 at this venue - or even 400. Herath's thinking, perhaps, was to eliminate the chance of a Bangladesh victory almost entirely, which might allow him to ring the batsman with fielders with little consequence.
This is in fact what he did in the 15 overs Bangladesh batted, and perhaps it is what allowed Sarkar to hurtle to 53 off 47 balls by the close of play. He hit six fours and one six - all off the spinners, and all square of the wicket. Herath did not bring the younger, more attacking bowlers on before stumps; Lakshan Sandakan and Lahiru Kumara would be reserved for the big push on the final day.
In the morning session, neither opening batsman had seemed fluent, and with both their places in the side under some pressure, had not ventured many attacking strokes. In fact one of the few occasions that Karunaratne attempted to hit out, he supplied Bangladesh an opportunity to get him out: Shakib going on to drop the mis-hit lofted drive at short cover to deny Mehedi a wicket. He was moved to caution by that scare, but did not make much use of the second life, swatting a Taskin Ahmed ball carelessly into the legside, where Mahmudullah ran in off the rope to complete and excellent diving catch. Though Bangladesh also made plenty of fielding mistakes, there would be an even better catch later in the day, when Liton Das lunged to his left to intercept a reverse-paddle from Niroshan Dickwella.
More rain is forecast for the fifth afternoon, but to defy Sri Lanka, Bangladesh will have to resist Herath - the bowler with the most fourth-innings five-wicket hauls in cricket, bowling on a favourite strip.
Andrew Fidel Fernando is ESPNcricinfo's Sri Lanka correspondent. @andrewffernando