Pep Guardiola's side had led through goals by Xavi and Messi inside the opening 12 minutes at Camp Nou before Ruben Castro pulled one back after half an hour and Roque Santa Cruz made it 2-2 in the second half.
The visitors had Mario sent off with 19 minutes remaining for a second booking before Alexis' shot restored the lead 15 minutes from time and Messi made it 4-2 with a late penalty.
The hard-fought win ensured Barca remain five points off leaders Real Madrid.
Betis started brightly and Jorge Molina forced Victor Valdes into a scrambling save at his right-hand post before Jose Antonio Dorado's header required another good stop.
But with their first meaningful advance, the champions were ahead. Alexis made headway on the left and slipped in Cesc Fabregas. The midfielder rattled his shot off the post but Xavi was on hand to fire home the rebound.
No sooner had the game restarted than it was 2-0.
Alexis was again heavily involved, breaking down the left and firing across the low cross for Messi to tap home from close range.
Betis' Ruben Castro fired over before then managing to pull a goal back.
Molina was played in on the left and after he dragged the ball back for Salva Sevilla to scuff a curling ball into the box which Ruben Castro side-footed home, to the annoyance of a Barcelona defence left standing with their arms raised in an appeal for offside.
Barca were punished in the 52nd minute for more slack play as Santa Cruz levelled. The Paraguayan snapped up a loose ball from Andres Iniesta's error and played the ball out wide to Molina, who carried it forward and played it inside for the striker to curl around Valdes and into the net.
Barca were then denied two penalty claims, the first for handball which looked more ball to hand, and the second when Jefferson Montero felled Iniesta only for referee Ignacio Iglesias Villanueva to book the Barca man for diving.
Betis then had former Barca defender Mario sent off for a second booking
Messi had a chance and Alexis headed woefully off-target at the far post before making amends with what proved to be the winner.
A clever run was found perfectly by Xavi's chipped through ball and, after moving slightly too wide, the Chile forward fired off a snapshot from 25 yards which had goalkeeper Espinosa Casto beaten.
The win was wrapped up with five minutes to play when Dorado conceded a penalty for handball from Abidal's shot and Messi stroked the ball home powerfully.