An alarm sounded at Paesan's Pizza on Guilderland Avenue in Rotterdam in Schenectady County around 1:00 Friday morning.
When police arrived, they heard screams for help, which sounded like they were coming from the roof.
The fire department headed to the scene with a ladder.
Investigating officers found Timothy J. Cipriani, 46, lodged inside a metal rooftop ventilation shaft pleading for help.
Inside the pizza shop, officers found his leg sticking out the shaft opening directly above the deep fryers in the kitchen area.
Cipriani told officers he was attempting to burglarize the pizza shop when he got stuck and now just wanted the police to help him out.
Firefighters had to cut him out of the ventilation system.
Cipriani was taken into custody and immediately treated by medical personnel on scene. Cipriani was released on parole back in January.
He's headed back to jail on burglary and related charges.