Kumar Sangakkara top-scored with 112 in a commanding Sri Lanka total of 300 for nine and England struggled in reply until the arrival of Buttler who smashed 121 off 74 balls.
It was only when Buttler and Bopara combined that England found an effective counter to Sangakkara’s outstanding hundred.
Lasith Malinga had reduced England to 10 for two, needing just one delivery each to dismiss openers Alastair Cook and Ian Bell.
Harry Gurney, with a international best four for 55, and Chris Jordan then each took two wickets in their final overs as the late trade-off marginally favoured England.
Kusal Perera, replacing Dinesh Chandimal on the sheet but in Thirimanne’s opening position, began the Sri Lanka innings with successive boundaries in James Anderson’s first over. He added a pulled six off Gurney but, trying to thrash the left-armer to leg again, toe-ended a looping catch to slip where Jordan dived to his left to hold on.