Sri Lanka 117 and 282 for 6 (Mendis 169*) lead Australia 203 by 196 runs
Scorecard and ball-by-ball details

Kusal Mendis had one first-class century before today. He walked to the crease at 6 for 2, after a wicket fell on the third ball of the morning. Sri Lanka were 80 short of making Australia bat again. Mendis had survived only seven deliveries in the first innings. The ingredients were all wrong, but like the world's greatest chef he worked his magic and fashioned them into something delicious.

Sri Lankan fans could only have dreamed of such a Kandy treat when play began. Yet by tea, Sri Lanka had at the very least made this a 50-50 battle and by stumps, called early due to bad light and rain, they were unquestionably on top. Their first-innings debacle of 117 had made their job tough, but Australia's task in the fourth innings against Rangana Herath and friends would be no easier.

Already the target stood at 197 but four wickets were still in hand. Importantly, one of those was Mendis, who walked off to a standing ovation on 169. This from a man whose previous highest score - in first-class cricket, mind you - was 108. This in a Test match in which no other batsman has reached 50. By stumps, you wouldn't be surprised if he turned this into a double-century.

All he would need was a little lower-order support. Dilruwan Perera was on 5 when the players walked off, having not long joined Mendis following the dismissal of Dhananjaya de Silva for 36. Mindlessly, de Silva had lofted a simple catch to mid-off to give Nathan Lyon his second wicket of the innings and the 200th of his Test career, the first Australian offspinner to reach that milestone.

Mendis was sublime all around the wicket. He played straight when required but always looked to score, pulling and flicking classily through leg, sweeping effectively, cutting when the fast bowlers gave him width. He struck 20 fours and brought up his century from his 143rd delivery with his only six, slog-swept over deep midwicket off the bowling of Lyon.

Mendis had made few mistakes throughout his innings, though on 142 he drove a tough caught-and-bowled opportunity through the hands of Josh Hazlewood. Australia were also left to regret not asking for a review when Mendis was on 66, after he missed a sweep off Lyon, who was coming around the wicket. The Australians seemed barely interested in sending that one upstairs.

Instead, they frittered away both of their reviews on deliveries from Steve O'Keefe that were, respectively, pitching outside leg and only just clipping leg stump. Australia were not alone. Not since United Passions hit the cinemas have worse reviews flowed from all directions. Dimuth Karunaratne and Kaushal Silva both needlessly contested their lbws early in the morning.

Mitchell Starc's pace beat Karunaratne in the first over of the day and O'Keefe sneaked his arm ball through the defences of Silva. Neither man reached double figures, and nor did the captain Angelo Mathews, who on 9 was caught at bat-pad off the bowling of Lyon. Australia had picked up three wickets before lunch, but already Mendis was past 50 and proving a headache.

Things got trickier for Australia in the second session as Mendis and Dinesh Chandimal compiled a 117-run partnership, easily the highest of the match. O'Keefe left the field with an injury to his right hamstring, and any half-chances presented to Australia seemed to go begging. On 24, Chandimal popped up a very catchable return chance that was spilled by Starc.

Finally the breakthrough came, as Chandimal was trapped lbw by Mitchell Marsh, who managed to nip the ball back in late. Still, it was the only wicket of the session, for Mendis found a new ally. The debutant de Silva, who got off the mark with a six in the first innings, boldly thumped a boundary over mid-on to get off the mark this time, and by tea the new partnership had grown to 50.

But this day was all about Mendis, the rest were simply his support staff. Just before tea he brought up his 150 with a cut to the boundary off Lyon, from his 207th delivery. By stumps, his score looked outrageous compared to the rest of the top order: 4, 7, 0, 169*, 9. It is hard to believe if anybody present - even Mendis himself - could have anticipated such a scenario this morning.

Brydon Coverdale is an assistant editor at ESPNcricinfo. @brydoncoverdale