Willson Contreras and Marcelo Mayer each hit sixth-inning home runs to break a 2-2 tie as the Boston Red Sox snapped a five-game losing streak by defeating the San Diego Padres 5-2.