Matthew Prior's second consecutive century looked to have put the home side in control at Lord's with a first-innings 486 all out, but Dilshan survived a rocky first few overs after lunch to score 127 not out.
Dilshan and Tharanga Paranavitana (65) set a record opening partnership of 207 in matches between the sides, as a benign pitch and some mundane bowling allowed the batsmen to stay on top all day.
But after two days of bright sunshine, overcast conditions are forecast from Sunday, offering the pace bowlers more assistance for the remainder of the test.
The intervention by Sri Lanka's openers was crucial after its bowlers had looked short of ideas and low on morale at the start on Saturday, allowing Prior and Stuart Broad to add 68 off the first eight overs. But with James Anderson out injured, England's pace bowlers were just as mediocre as they failed to sufficiently control both line and length.
Two missed catches by each side just compounded things, with a total 375 runs added during the day for the loss of just five wickets.
After an innings defeat in Cardiff, Sri Lanka needs to win at Lord's to have any chance of winning the three-test series. Dilshan went after the frequent wayward balls served up by Chris Tremlett, Steven Finn and Broad to give his team every chance of at least a draw, reaching his century from 129 balls in his second test as captain.
Paranavitana anchored things as Dilshan scored almost twice as quickly and looked set to make it through the day undefeated, but he went for another of Finn's wide deliveries and edged to Andrew Strauss at slip with about half an hour left.
That brought Kumar Sangakkara to the crease, where he remained at the close of play on 13 not out.
Broad progressed briskly in the morning session before falling lbw for 54 to Chanaka Welegedara - who removed Graeme Swann in the same over to finish with 4-122 - but Prior's 126 was the key to England passing 400 for a fourth straight innings.
Still, captain Strauss' decision not to declare when Prior fell appeared to surrender some momentum. Instead of having to bat an uncomfortable 20 minutes or so before lunch, Sri Lanka was able to regroup over the lunch break after Tremlett and Finn added an gritty but arguably unnecessary 34 from the last 44 balls.
Broad beat the bat three times in the first over of Sri Lanka's reply as he shaped the ball away from the left-handed Paranavitana and Dilshan, who put England into bat on Friday, then swung and missed at Tremlett's first delivery.
Alastair Cook, who scored 96 on day one, then dropped Paranavitana when he was on 13, but that was about it for a long time.
Sri Lanka closes day two at 231-1
Advertisement