A 19-year-old Rockford man has been sentenced to 20 years in prison for a McHenry County burglary during which he was interrupted by and shot at a homeowner.