A Southern California teen who pleaded guilty to killing a gay classmate was sentenced late Monday to 21 years in prison.