BALTIMORE (AP) -- It was one of those rare days when everything went right for the Houston Astros.
Houston took an early lead and added to it late. The starting pitching was solid. The bullpen was nearly perfect.
The result was a 5-2 victory over the Baltimore Orioles on Sunday that enabled the young Astros to avert a three-game sweep.
"Overall, a good team win," manager Bo Porter said.
Jason Castro and Marc Krauss homered to account for all of Houston's offense, and Jarred Cosart (2-3) allowed two runs over six innings for the Astros, who had lost seven of eight before ending Baltimore's five-game winning streak.
Castro hit a three-run homer off Chris Tillman (3-2) in the first inning, and the Astros made the advantage stand up.
"When we can come out and score early, that's really when we're at our best," Castro said. "It kind of gives some of the young staff a little bit of a breather from the beginning."
It was 3-2 before Krauss connected against T.J. McFarland with a runner on in the seventh.
"Those are the runs we have not been able to get," Porter said. "Those tack-on runs that give you an extra cushion, make it a three-run lead instead of a one-run lead. That was a huge home run."
Houston is 11-11 when it hits a home run and 1-15 when it doesn't.
Although the Astros' bullpen came in with a 6.21 ERA, Tony Sipp struck out five in two perfect innings and Chad Qualls worked a hitless ninth for his second save.
"I have confidence no matter who they put in behind me that they can get the job done," Cosart said.
Jose Altuve had three hits for the Astros, who improved to 6-12 against the Orioles -- including 2-10 at Camden Yards. Everything seemed to fall into place for the team with the worst record in the major leagues.
"We've played some good baseball the last two days," third baseman Matt Dominguez said. "Pitched the ball well, got some timely hits. Hopefully that can give us a jumpstart."
Adam Jones drove in both Baltimore runs, giving him 501 RBIs in 981 career games.
Tillman gave up three runs, four hits and a season-high five walks in five innings. The right-hander settled down after issuing three walks and a home run in the first inning, but needed 105 pitches to get 15 outs.
"It was a struggle for me. Fastball command wasn't there for me from the get-go," Tillman said. "It was a battle all day."
Before the game, the Orioles activated Chris Davis (strained left oblique) from the 15-day disabled list and put catcher Matt Wieters on the DL with a strained right elbow. Davis went 2 for 4 in his first game since April 25.
"Felt good," Davis said. "Timing is a little off, little in-between. But it was definitely good to be in there, moving around again."
Houston took a 3-0 lead before Tillman retired a batter. After Altuve and Dexter Fowler walked, Castro hit the right-hander's next pitch over the center-field wall. Tillman has yielded seven first-inning runs this season, his most in any inning.
"He kept us in the ballgame and threw some zeros up after that," manager Buck Showalter said. "But it wasn't what he's capable of or what we've come to expect. Or more importantly, what Chris has come to expect."
Jones hit a two-run single to get Baltimore to 3-2 in the third.
A double by Davis in the fifth put two runners in scoring position, but Jones struck out before Nelson Cruz flied out.
RED SOX 5, RANGERS 2
ARLINGTON, Texas -- A.J. Pierzynski and Mike Napoli had run-producing hits in the first inning against their former team and the Boston Red Sox got above .500 for the first time since three games into the season with a series-clinching 5-2 victory at Texas on Sunday.
Napoli put the Red Sox ahead to stay with an RBI double, two batters before Pierzynski's two-run single. Both went to Boston as free agents after being in Texas -- Pierzynski was the Rangers primary catcher last season, and Napoli was there the previous two years.
John Lackey (5-2) struck out nine while allowing two runs over seven innings.
Rangers lefty Robbie Ross (1-4) made it through 62/3 innings and a career-high 112 pitches.
ROYALS 9, MARINERS 7
SEATTLE -- Alcides Escobar hit a grand slam and Johnny Giavotella added a three-run shot to give the Royals a comeback victory over the Mariners.
Escobar had provided a 4-0 lead for the Royals in the second with his first career home run off starter Roenis Elias. But the Mariners rallied behind two homers from Dustin Ackley and another from Kyle Seager before Kansas City took the lead in the seventh, scoring four runs off reliever Danny Farquhar (1-1).
Louis Coleman (1-0), who worked a scoreless sixth, earned the victory.
The Mariners committed a season-high four errors.
ANGELS 9, BLUE JAYS 3
TORONTO -- Jered Weaver won his fourth straight decision, Hank Conger hit a three-run homer and had a career-high five RBIs, and the Angels beat Toronto for their seventh straight win over the Blue Jays.
Conger went 3 for 4 with a walk. He hit an RBI double in the fourth, homered in the sixth and added an RBI single in the ninth.
Howie Kendrick had three hits, two stolen bases and scored three times as the Angels won their third straight.
Weaver (4-2) improved to 4-0 with a 1.71 ERA in his past four starts.
Blue Jays right-hander Drew Hutchison (1-3), who has not won in seven starts, allowed three runs and three hits in 41/3 innings. He matched a career-high with four walks and struck out five.
GIANTS 7, DODGERS 4
LOS ANGELES -- Pablo Sandoval and Hector Sanchez hit RBI singles in the 10th inning, and the San Francisco Giants recovered to beat the Los Angeles Dodgers 7-4 Sunday after closer Sergio Romo gave up a tying homer to Hanley Ramirez.
Brandon Hicks hit a two-run shot off Clayton Kershaw, and Buster Posey had an RBI single for the NL West leaders, who beat the defending division champions for the seventh time in 10 meetings this season.
The Giants finished their road trip 7-3 and played errorless ball over the last five games.
Romo (3-0) came on in the ninth to try and protect a 4-2 lead for Tim Hudson. The right-hander struck out Yasiel Puig after a one-out double by Dee Gordon, but Ramirez lined his fifth homer to left field. The blown save was Romo's first this season in 13 chances.
Angel Pagan drew a leadoff walk in the 10th from Kenley Jansen (0-2) before Hunter Pence singled.
Jean Machi got three outs for his first major league save.
BRAVES 5, CUBS 2
ATLANTA -- Evan Gattis hit a tiebreaking homer, Jason Heyward added a two-run shot and Atlanta beat Chicago to complete a three-game sweep.
Gattis gave the Braves a 3-2 advantage with his homer off Edwin Jackson in the fourth inning. Heyward added to the lead with his first home run since April 9.
Aaron Harang (4-3) gave up two runs in six innings with nine strikeouts. David Carpenter pitched the ninth for his second save as closer Craig Kimbrel was rested after pitching two straight days.
Jackson (2-3) allowed three runs and six hits in six innings.
The NL East-leading Braves have recovered from seven straight losses by winning four of five. The Cubs, last in the NL Central, have dropped seven of eight.
PADRES 5, MARLINS 4
SAN DIEGO -- Will Venable hit a leadoff homer and San Diego beat Miami for its first three-game winning streak of the season.
The resurgent Padres offense, which has scored 24 runs in three games, also got two hits and two RBIs from Chris Denorfia.
Robbie Erlin (2-4) scattered five hits over 61/3 scoreless innings before giving way to three relievers. Huston Street pitched around a hit and two walks in the ninth to earn his 11th save.
Erlin, who didn't walk a batter, had seven strikeouts to match a career high. He had lost four straight decisions.
Padres pitchers struck out 48 in the four-game series to set a franchise record.
Henderson Alvarez (2-3), who was coming off his second shutout of the season and third in his last eight starts, wasn't sharp. He lasted four innings, allowing five runs and seven hits with three walks.
Christian Yelich homered for the Marlins and Jeff Baker had a two-run triple.
CARDINALS 6, PIRATES 5
PITTSBURGH -- Shelby Miller won his fourth straight start and Trevor Rosenthal induced a bases-loaded double play to end the game as the Cardinals held off the Pirates.
Allen Craig and Yadier Molina had two hits each, including RBI singles in a four-run first inning. Craig went 5-for-11 in the three-game series after entering with a .202 batting average. Molina was 0-for-12 in his previous four games.
Miller (5-2) walked four and allowed four hits in 51/3 innings, but held the Pirates to just two runs -- which came on Jordy Mercer's first home run of the season in the fourth inning.
Rosenthal gave up a run in the ninth that made it 5-4, but got Mercer to hit into a 1-2-3 double play to end it.
Charlie Morton (0-5) took the loss.
BREWERS 6, YANKEES 5
MILWAUKEE -- Mark Reynolds hit a game-ending single with two outs in the ninth inning, and Milwaukee overcame Francisco Rodriguez's first blown save of the season to beat New York.
Rickie Weeks doubled just inside first base with one out before going to third on a wild pitch by reliever Adam Warren (1-2).
Reynolds, who spent part of last season with the Yankees, held his right index finger in the air after his hard chopper bounced past diving third baseman Yangervis Solarte.
New York was one strike from defeat in the top of the ninth when Mark Teixeira homered off Rodriguez (1-0). It was the first run allowed all season by the veteran closer.
Before the game, the Yankees put struggling left-hander CC Sabathia on the disabled list with a right knee injury.
ATHLETICS 9, NATIONALS 1
OAKLAND, Calif. -- Derek Norris hit a pair of three-run home runs to back Scott Kazmir's fifth win and the Athletics beat the Nationals to complete a series sweep.
Both of Norris' home runs came on identical two-out, 3-0 pitches from Washington starter and former Oakland pitcher Gio Gonzalez (3-3).
Nick Punto added two hits and three RBIs while Brandon Moss singled twice and doubled. Oakland has won four straight since dropping five of six against Boston and Seattle.
Kazmir (5-1) bounced back from his first loss of the year to pitch seven scoreless innings while allowing only four hits.
DIAMONDBACKS 5, WHITE SOX 1
CHICAGO -- Chase Anderson won his major league debut, Gerardo Parra and Miguel Montero homered, and the Diamondbacks beat the White Sox.
Recalled Tuesday from Double-A Mobile, Anderson (1-0) hadn't seen any action until Sunday and he excelled in his first big league appearance, at one point retiring 12 consecutive batters. He allowed one run and only two hits in 5 1-3 innings while striking out six, helping Arizona win for the fourth time in five games and secure its third consecutive series for the first time since June 2012.
Parra's fifth-inning drive off Hector Noesi (0-3) gave Arizona a 3-0 lead.