A strange ejection occurred in the sixth inning when Hernandez was tossed by plate umpire Mark Ripperger after hitting Castro on the left arm with a fastball. There were no previous warnings, hit batters, or inside pitches. Phillies manager Ryne Sandberg also was ejected after he came out to argue.
''I don't think he did it on purpose,'' Castro said. ''He's a good friend of mine. I see him every day in the Dominican. I don't think he would do that on purpose. He told me, 'I'm sorry.' It's not on purpose. I already know. He's not like that. He's not that kind of person.''
The umpires didn't see it that way.
''In our opinion he threw at the hitter,'' crew chief Gary Cederstrom said.
Asked if a warning should've come first, Cederstrom said: ''I thought the appropriate action was taken.''
Hernandez was baffled. He threw his arms up in disbelief on the mound before walking off the field to cheers from the crowd.
''I was very, very surprised,'' he said. ''I didn't throw that on purpose. I wanted to continue to throw the ball down. I had two outs. I wanted to pitch into the next inning. I didn't throw it on purpose. I wanted to keep pitching.''
Arrieta (2-1) allowed two hits and no runs, tying a career high with nine strikeouts. He didn't give up a hit until Domonic Brown sliced a double just inside the left field line with one out in the fifth.
''I had a good mix tonight, good velocity, good movement, good location,'' Arrieta said. ''With those three things, you're going to have success. It's never easy to win and have success at a high level. But you do things the right way and learn, day in and day out, and try and get better at least one thing every time you come to the yard, you give yourself an opportunity to perform at a high level.''
The Phillies were seeking their first four-game winning streak since last June 2-6.
Hernandez (2-5) allowed two runs and three hits in 5 2-3 innings. He walked Anthony Rizzo leading off the fourth. Castro then drove his ninth homer out to left.
Jimmy Rollins led off the bottom of the ninth off Neil Ramirez with a double to tie Mike Schmidt's franchise record of 2,234 hits. After Marlon Byrd walked with two outs, Brown hit an RBI single to right to cut it to 2-1.
But Ramirez struck out Carlos Ruiz looking to end it and earn his second save.
''Too little too late,'' Sandberg said. ''We just came up short at the end.''
NOTES: The Cubs activated CF Ryan Sweeney from the disabled list and placed INF/OF Emilio Bonifacio on the 15-day DL. ... Phillies ace Cliff Lee threw again on Friday, but it's uncertain when he'll rejoin the rotation. Lee has missed four starts with an elbow strain. ... Phillies setup man Mike Adams received a cortisone shot in his ailing right shoulder and is expected to start a throwing program in 10 days. ... Phillies 3B Cody Asche (hamstring) began a rehab assignment at Class-A Lakewood. He could return to the lineup late next week. ... Both teams wore 1964 retro uniforms. ... Edwin Jackson (4-6, 4.70) goes for the Cubs against David Buchanan (1-3, 6.08) on Saturday afternoon.
Follow Rob Maaddi on Twitter: https://twitter.com/AP-RobMaaddi