A man who pleaded guilty to robbing two banks in October was sentenced this week to four years in prison.