UNC survived a late Stanford rally on Saturday night, winning its second-straight football game in improving to 4-5.