Messi suffered the injury in the first leg of a Champions League quarter-final against Paris Saint-Germain and he has been in and out of the team ever since.
He came off the bench to inspire a Barca win against PSG in the Nou Camp return but looked a shadow of his brilliant best as the Spanish champions were hammered 4-0 in the first leg of their semi-final meeting with Bayern Munich.
He failed to make an appearance as Bayern duly completed a 7-0 aggregate win in Catalonia.
Messi underwent a scan on Tuesday morning with a Barca statement revealing the results. It read: "Tests showed that Leo Messi has an elongation in the femoral biceps in his right leg. The expected absence is two to three weeks.
"How the injury evolves will determine the player's availability for future games."
Messi started Sunday's win at Atletico Madrid but limped off after 67 minutes after experiencing further problems with the injury.
Barca's final game of the Primera Division season - they have already wrapped up the title - is scheduled for June 1 at home to Malaga.
It is unlikely Messi will be risked by Barca boss Tito Vilanova, especially as the 25-year-old will be needed by Argentina for their World Cup qualifying double-header against Colombia and Ecuador in June.
Messi has enjoyed another wonderful season in Spain, scoring 46 league goals - four short of the record-breaking tally of 50 he notched in 2011-12.