In a strong comeback after a heavy innings defeat in the first Test, at the close of play Ireland's Lorcan Tucker was unbeaten on 78 and Curtis Campher was not out 27.
Having made three changes, Ireland began nervously as Peter Moor departed for five and Sri Lanka's first Test hero Prabath Jayasuriya removed James McCollum for 10.
But captain Balbirnie held firm in hot and humid conditions, grinding out a 115-run partnership with the returning Paul Stirling after Harry Tector fell to Jayasuriya for 18.
It was the highest partnership for Ireland in their brief Test history -- this is only their sixth match -- surpassing a 114-run stand from their inaugural Test in 2018.
Stirling, who had missed the first Test, exhibited his experience punishing loose balls as he reached his maiden half-century in Test cricket off 64 balls.
But his promising knock was cut short when he had to retire hurt with cramps. His 74 came off 133 balls with six fours and three sixes.
Balbirnie, meanwhile, raced to his third half-century off just 43 balls with 10 boundaries but was sedate after the milestone as he built the crucial partnership with Stirling.
Balbirnie missed out on the chance to become only the third Irishman to score a Test century, caught after a wild paddle sweep off Kusal Mendis for 95, beating his previous best of 82.
Tucker was then caught bat-pad by Mendis off Jayasuriya but the appeal was turned down and skipper Dimuth Karunaratne chose not to review.
This is now Ireland's second-highest total in Test cricket behind the 339 all out against Pakistan in 2018.
Ireland are yet to win a game in the five-day format since obtaining Test status in 2017, losing all five of their outings so far including to Bangladesh in early April.