The Catalan giants were dumped out of the Copa del Rey by Athletic Club in midweek, while Messi has been involved in a public spat with technical director Eric Abidal after he questioned the work ethic of some players under previous boss Ernesto Valverde.
Quique Setien's side got off to a terrible start against his former employers, with Sergio Canales' penalty putting the hosts ahead early on, but a wonderful goal from Frenkie de Jong pulled the champions level soon after.
2 - @FCBarcelona's Lionel Messi is the second player to reach double figures for both goals (14) and assists (10) in the top five European leagues this season, after Jadon Sancho (12 & 13). Critical. pic.twitter.com/zpO8Ml8H3z— OptaJose (@OptaJose) February 9, 2020
Nabil Fekir - who was later dismissed for two bookable offences in quick succession - restored the hosts' advantage with a fine finish, before Sergio Busquets scored a second equaliser on the stroke of half-time.
Clement Lenglet then headed home Messi's free-kick 18 minutes from time to ensure Barca remain three points behind leaders Real Madrid after their 4-1 win at Osasuna earlier in the day, although the Frenchman blotted his copybook by picking up a second yellow card soon after Fekir's dismissal.
Betis opened the scoring in the sixth minute, Canales stroking home from the penalty spot after Lenglet had handled Fekir's strike inside the penalty area.
Their lead lasted just three minutes, though, as De Jong chested down Messi's superb ball over the top and volleyed past Joel Robles from six yards.
Fekir rounded off a swift counter-attacking move with a fine low strike from 18 yards past Marc-Andre ter Stegen to restore Betis' advantage just before the half-hour mark.
Messi was again the provider for Barca's equaliser in first-half stoppage time, his deep free-kick turned in by Busquets from eight yards.
Messi was twice denied by Robles after the interval but he was central to Barca's winner, floating in a free-kick that was headed home by a towering Lenglet.
Fekir saw red 14 minutes from time, picking up quickfire bookings for a foul on Lenglet and dissent, while Barca's French defender also received his marching orders three minutes later after catching Joaquin.