At stumps, England were 279 for six, having been 84 for four when Bairstow (107 not out) came to the crease. It had been a similar story when Bairstow revived England from the depths of 83 for five in the first Test with a superb 140 on his Headingley home ground in a match England eventually won by an innings and 88 runs.
Rather than scoring a maiden Test century at Lord's, Bairstow should have been out for 11 on Thursday when he clipped Nuwan Pradeep firmly off his pads straight to mid-wicket only for Shaminda Eranga to drop the catch.
Replays showed the ball hitting leg stump, but not enough, according to the Decision Review System, to overturn Indian umpire S Ravi's original not out decision.
Apart from Bairstow, only England captain Alastair Cook (85), who won the toss in sunny conditions ideal for batting, passed fifty on Thursday, with Chris Woakes 23 not out at stumps.
Also Read
Sri Lanka performed admirably with the ball, albeit they were again sloppy in the field, on a good pitch where there was a touch of seam movement. Suranga Lakmal and Nuwan Pradeep shared four wickets while impressive left-arm spinner Rangana Herath rook an economical two for 45 in 21 overs.
Cook insisted in the build-up to this match that England were determined to correct their habit of losing 'dead' Tests in series they'd already won following heavy defeats at the end of victorious campaigns at home to Australia in 2015 and away to South Africa earlier this year.
But Herath struck with just his fourth ball he had Hales
(18), slogging across the line of a ball that turned, caught by Sri Lanka captain Angelo Mathews at slip.
By his own admission, Nick Compton was playing for his Test place. But England's number three, on his Middlesex home ground, fell for one when he was caught behind off a gentle Lakmal away-swinger.
Left-handed opener Cook was closing in on his 29th Test century when, shortly before tea, he was plumb lbw to Pradeep, bowling from around the wicket. Cook faced 173 balls, including nine fours.
Moeen Ali, fresh from his Test-best 155 not out at the Riverside, followed Hales in falling to the Herath/Mathews combination for 25.