Messi has broken Gerd Muller's long-standing record for the most league goals scored for the same club in Europe's top five divisions.
The Barcelona superstar, who equalled the tally while making his 400th LaLiga appearance for the Calatan giants against Levante last weekend, netted his 366th goal in Spain's top flight during the 4-2 win over Real Sociedad on Sunday.
Messi's left-footed free-kick from 25 yards saw him overtake Muller's haul of 365 Bundesliga strikes for Bayern Munich.
Germany great Muller set the previous record while representing Bayern between 1964 and 1979, scoring his 365 goals in 427 Bundesliga matches.
Messi has been in irresistible form for Barca this season, scoring 16 goals and providing eight assists in LaLiga as the club have surged to the top of the table.
Barca's win over Sociedad took them nine points clear of second-placed Atletico Madrid, and 19 clear of eternal rivals Real.