From Sonic Retro
The Perfect Bonus is a bonus the player is able to receive in Sonic the Hedgehog 2, Sonic the Hedgehog 3, Sonic & Knuckles, Sonic Generations and Sonic Mania. It has a different behavior in each of these games.
Behavior in games
Sonic the Hedgehog 2
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. However, some levels have rings placed in odd locations such as hidden within walls or far beyond the player's reach, therefore making a Perfect Bonus impossible to achieve. More information can be found here.
Sonic the Hedgehog 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.
In Sonic Generations, the Perfect Bonus is known as a Perfect Clear, though is still addressed as a "Perfect Bonus" in the manual. To earn a Perfect Clear, 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. Perfect Clears are achieved in the HD versions of the game; they are not present in the Nintendo 3DS version.
Perfect Bonuses are earned in the Blue Spheres Bonus Stage, and are earned in the same way as in Sonic 3 & Knuckles by collecting every ring. This causes the Medallion earned at the end of the Bonus Stage to become gold. While only silver medallions are needed to unlock all of the game's extra content, collecting all the gold medallions will award an achievement/trophy.
The screen you see in Blue Sphere when you get a perfect.