Messi's second-half goal saw him overtake the mark which the Brazil great had amassed over 19 seasons for Santos.
Ronald Koeman's men closed out for a first away LaLiga win since the start of October to sit fifth in the table, eight points behind leaders Atletico Madrid, who had earlier won at third-placed Real Sociedad.
Messi eyed an early chance to break the record during the opening exchanges at Estadio Jose Zorrilla, his curling shot from the edge of the penalty area dropping just wide.
The Argentina playmaker saw another effort tipped over by Valladolid goalkeeper Jordi Masip before Barcelona took the lead in the 21st minute.
Messi was the creator this time, floating a cross into the centre of the penalty area, where Lenglet powered a header into the net.
The Barca players used the goal celebration by holding up a shirt to pay tribute to right-back Moussa Wague, the 22-year-old having suffered a serious knee injury while playing on loan at Greek club PAOK.
Before Valladolid could regroup, the home side found themselves 2-0 down after 25 minutes.
Messi held off three opposition players before feeding the ball down the right for Sergino Dest and his low cross was slid past Masip by Braithwaite.
Barcelona maintained their momentum at the start of the second half, as Braithwaite stabbed an early chance wide.
Masip then denied Messi again as the hour mark approached with another decent reaction save.
Barcelona's talisman, though, got his record-breaking goal after 65 minutes when played in by a neat backheel from Pedri.
Barca substitute Philippe Coutinho drilled a low, 20-yard effort against the base of the post.
Valladolid were again saved by the woodwork in stoppage time when Messi charged through, only to see his angled shot come back of the upright.
The Argentina playmaker looked determined to increase his record tally, but Masip produced another fine save to keep the scoreline down.