The final agreement for the Poland striker is for a €45 million fee, with €5m in potential add-ons.
Lewandowski will be announced as a Barca new player over the weekend, according to sources.
Barca made Lewandowski one of their primary targets this summer with coach Xavi Hernandez keen to add more firepower to his squad ahead of the new campaign.
– Preseason schedule: When, where, who Europe’s top clubs will play
– Explainer: How Barca are signing players amid finance woes
– LaLiga 2022-23 schedule: What the fixture list reveals
– Don’t have ESPN? Get instant access
Lewandowski, meanwhile, has made it clear through a series of public interviews that he is ready to leave Bayern after eight seasons with the German champions.
The striker has spoken of his desire to take on a new challenge as he enters the final years of his career. He turns 34 in August.
Barca had previously failed to bring Bayern to the negotiating table as the Bundesliga side played hardball despite the fact Lewandowski has just one year left on his contract.
ESPN revealed at the end of June that Barca had lodged a third bid, worth north of €40m including add-ons, but had received no response from Bayern.
However, there was finally a breakthrough in talks this week, with the two clubs reaching an agreement over a fee.
Lewandowski, named Best FIFA Men’s Player in each of the last two years, has scored 344 goals in 375 appearances during his eight campaigns with Bayern.
Prior to that, he scored 103 times in 187 games with Borussia Dortmund, who he joined from Lech Poznan in 2010 following spells with Znicz Pruszkow, Legia Warsaw and Delta Warsaw.