It was the Highlanders who started the better side.
They took the lead after 26 minutes when All Black winger Waisake Naholo powered his way over to score the first try of the game.
The Lions regrouped and responded with a try of their own to level the scores at 10-10.
Second-half tries from returning captain Sam Warburton and Tommy Seymour looked to have put the Lions in control, before the hosts responded.
"Unfortunately, some big moments we didn't nail allowed them back into the game," coach Warren Gatland said after his team led 22-13 mid-way through the second half.
Owen Farrell dragged a Lions penalty wide before Marty Banks landed what proved the decisive kick in Dunedin.
"We needed some strong game management to close the game down. We've taken a little bit of a step backwards but we have to learn from those moments," Gatland added.
The Lions now have two wins and two losses after four outings on their gruelling 10-match New Zealand tour.
The tourists return to action against the Maori All Blacks on Saturday, their fifth of six warm-up matches before the first of three Tests against the All Blacks on 24 June.