AJ McLean's pit stop on the Vegas Strip -- during the Formula 1 Grand Prix festivities -- had A-listers doing laps around the glitzy event, and got AJ onstage with The Chainsmokers. The Backstreet Boys star put the pedal to the medal inside XS Nightclub at the Wynn Las Vegas Thursday night, as the trio performed a special rendition of his band's mega-hit "Everybody" -- but not before F1 superstar Lewis Hamilton and Will.i.am kicked things off at the exclusive invite-only opening ceremony the night before. On Friday, TikToker Alix Earle jumped into the DJ booth with Swedish House Madia at XS ... while Leo DiCaprio, Tobey Maguire, Michael B. Jordan, French Montana, and Saweetie partied in VIP. The whole weekend was packed with celebs in town for the main event ... Saturday night's race, where RiRi and her man A$AP Rocky immersed themselves in the action. No doubt, it was a nice break from reality for the rapper, ahead of his courtroom appearance Monday in his shooting case. The race was Formula 1's first in Las Vegas since 1982's Caesars Palace Grand Prix ... and Justin Bieber was living in the fast lane as he was selected to wave the checkered flag as Team Red Bull's Max Verstappen crossed the finish line first.