Two headers from Andy Carroll and a late goal from Diafra Sakho saw West Ham climb to third with a 3-1 win over Swansea.