With one eye on their Champions League last-16 second-leg against Lyon in August, and with the league title safely wrapped up, Juve boss Sarri has chose to rest the 35-year-old Ronaldo for the clash with Roma, with the Portugal star's chances of overhauling Immobile as the continent's top scorer in any case being slim.
Inter beat Atalanta 2-0 to come second.
Nothing is left to play for against Roma who are already assured of a fifth-place finish and the Europa League group stage next term.
Sarri had threatened to field Juventus's Under-23 team after his exhausted troops fell 2-0 to Cagliari during the week.
Gonzalo Higuain had put Juve in front in Saturday's Serie A finale but Perotti set up Nikola Kalinic's equaliser and put Roma ahead from the penalty spot before half-time at the Allianz Stadium.
Perotti stretched the lead seven minutes into the second half, sweeping home inside the area - via a deflection off Merih Demiral - after collecting Nicolo Zaniolo's perfectly weighted pass.
Danilo D'Ambrosio nodded in the first goal after just one minute with Ashley Young doubling their lead after 20 minutes with a stunning curling shot.
Atalanta failed to score for just the third time in Serie A this season, but finished on 98 goals - the highest total by any team in the Italian top flight in 68 years.
Lazio finished fourth with 78 points and Coppa Italia winners Napoli ended the season seventh with 62 points.
Lewandowski's domestic season is already over, having been crowned Bundesliga champions with Bayern back in June.
Lazio forward Ciro Immobile equalled the Serie A scoring record for a single season when he was on target in his side's 3-1 loss at Napoli in their final game of the season on Saturday (Aug 1).
Napoli warmed up for their Champions League last 16 second leg game over Barcelona with a win, but lost captain Lorenzo Insigne, who scored on the night, to injury.