From Sonic Retro
To earn a Perfect Bonus in Sonic 2, the player has to collect all the rings in a level. This does not include rings earned from Super Ring monitors. The player is awarded 50,000 points at the end of an act.
Sonic 3 / Sonic & Knuckles
To earn a Perfect Bonus in Sonic 3 or in Sonic & Knuckles, the player must collect all the rings in a Special Stage. This not only includes free-floating rings in the Special Stage, but also rings that are generated when a rectangular perimeter of blue spheres is cleared. The player is awarded 50,000 points at the end of the Special Stage for collecting all rings, regardless of if the player earned the Chaos Emerald at the end of the Special Stage.
There is no Perfect Bonus in Blue Sphere, as there is no score in this game. However, collecting all rings in a stage allows the player to see the difficulty level of the stage just completed and allows them to skip ten stages.
To earn a perfect bonus in Sonic Generations, the player must simply complete a level without dying. The bonus raises their rank for the level by one and is necessary to gain S Ranks in this game.