As reported by Motorsport.com last month, discussions about ending the partnership had been ongoing since the Brazilian president announced earlier this year he wanted the partnership to be concluded.
Now, just two weeks ahead of the Brazilian Grand Prix, both parties have agreed to end what was originally a five-year partnership.
The logos will be removed from the car for the Interlagos race.
McLaren CEO Zak Brown said: “We would like to thank Petrobras for their partnership and support.
“We have great respect for their technical and scientific capabilities, and there is no doubt the company’s technicians have made substantial progress in the time we have been working together. We wish everyone at Petrobras every success and hope to see them back in the sport again in the future.”
Petrobras, which is 64% owned by the Brazilian government, made clear that the decision to end the deal had nothing to do with results on track.
“We recognise the importance of McLaren in global motorsport and we are very satisfied with the results delivered during the two years of our partnership,” said its CEO Roberto Castello Branco.
“The project allowed Petrobras to develop high-technology gasoline and lubricants through research with new raw materials and tests performed in extreme conditions.
“The technological development will be used in lubricant and fuel products. We see in McLaren a commitment to innovation and also the possibility of future partnerships.”
Brown said over the United States Grand Prix weekend that McLaren would be adding further sponsors for 2020.