Brazil s forward Richarlison shoots the ball during the friendly football match between Brazil and Tunisia at the Parc des Princes in Paris on September 27, 2022 (AFP)
The game at the Parc des Princes was also briefly paused in the first half as the crowd were twice implored not to point laser pens at Brazil players.
"Unfortunately... a banana was thrown on the pitch towards Richarlison, scorer of the second Brazilian goal," the Brazilian football confederation (CBF) said on Twitter. "The CBF reinforces its position to combat racism and repudiates any prejudiced act."
The Selecao produced a dominant first-half display in their final outing before travelling to Qatar for the World Cup, with Raphinha netting twice and Neymar moving to within two of Pele's record.
Richarlison also found the net, while Pedro scored as a second-half substitute before responding to more boos and missiles from the crowd by bowing in front of them in celebration.
Tite's Brazil will head into their World Cup Group G opener against Serbia on November 24 on a 15-match unbeaten run, dating back to their Copa America final loss to Argentina last year.
The scene for a bad-tempered match was set when the vast numbers of Tunisia fans jeered the Brazilian national anthem before kick-off. Brazil created the first clear-cut chance of the game as Neymar slipped a pass through for Lucas Paqueta, but he could only fire a shot into the side-netting.
The South Americans did take the lead in the 12th minute, though, as Casemiro clipped the ball over the top and Barcelona winger Raphinha directed a wonderful looping header over Tunisia goalkeeper Aymen Dahmen and into the net.
Jalel Kadri's men hit back six minutes later. Defender Montassar Talbi met Anis Slimane's outswinging free-kick to send a powerful header into the bottom corner past 'keeper Alisson.
Incredibly, Brazil were back ahead just seconds after that setback, as Raphinha sent Richarlison in behind to drill a strike through the legs of Dahmen to score his third goal in two games after a double against Ghana.
The Tottenham forward celebrated in front of the Tunisian supporters, who responded by throwing a banana and plastic cups in his direction.
Fred kicked the banana off the pitch, before extra security guards took up residence on the side of the field.
Neymar nets penalty
Brazil almost extended their advantage as Paqueta followed a fine turn with a low shot which Dahmen tipped wide.
But from the resulting corner, Casemiro was hauled down in the box and Neymar stepped up to roll home his 75th international goal from the penalty spot, despite having lasers pointed at his face.
Brazil continued to cut through the visitors' defence with ease and Raphinha scored again in the 40th minute by firing in off the post from the edge of the box.
Things went from bad to worse for Tunisia before half-time as Dylan Bronn brought down Neymar and was harshly sent off after a brief melee between the two teams.
Tunisia were much improved after the break but Brazil still scored again with 16 minutes remaining through Flamengo forward Pedro's maiden goal for his country.
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO_Sports and on Facebook at AhramOnlineSports.)