The hosts, who drew 13-13 in France last week, sailed into a 17-0 lead but saw Bayonne gradually claw back the deficit to just four points before Masi crossed the line to calm the home fans' nerves.
Three Stephen Jones penalties and a try from Elliott Daly put Wasps 14-0 up inside the opening half-hour, and a penalty from Daly extended their lead before Joe Rokocoko's converted try on the stroke of half-time gave Bayonne hope.
Jones and Jacques Louis Potgieter exchanged penalties early in the second half before another Potgieter penalty hauled Bayonne back to just 20-16 down with 20 minutes left on the clock.
Billy Vunipola's sin-binning in the 62nd minute threatened to cost Wasps dear but Masi's try in the 73rd minute put the hosts firmly back in command and Nicky Robinson's subsequent conversion extended their lead back to 11 points.
Robinson kicked another penalty three minutes from time to put the gloss on a fine win for Wasps, which moves them five points clear of Bayonne at the top of their group with four games played.