Sogard homered twice and finished with a career-high five RBI, and the surging Rays beat the Miami Marlins 8-6 on Saturday night.
"Sogard, what a day he had," Rays manager Kevin Cash said. "He's been outstanding. Right now if he hits his pitch he's doing some damage with it."
Sogard is hitting .385 (5 for 13) in four games since he was acquired in a trade with Toronto on Sunday.
Willy Adames and Austin Meadows also connected as Tampa Bay won for the seventh time in eight games. Anderson (3-4), who came over in a trade with Miami on Wednesday, pitched a perfect eighth for the win, and Emilio Pagan finished for his ninth save.
"Nick Anderson is making quite an impression," Cash said. "We just love the fact that he comes in and attacks. That's not easy doing that against a group of guys that you were sharing lockers with five days ago."
The Rays went ahead to stay on Adames' leadoff drive against Jarlin Garcia (2-1) in the eighth. Travis d'Arnaud, who has 26 RBI since July 1, made it 8-6 with a run-scoring single later in the inning.
Sogard hit a two-run shot in the second and a three-run drive off Elieser Hernandez in the third. He has 12 homers this season, compared to 11 combined over his previous eight major league seasons.
"Joining these guys from day one I could tell was a lot of fun," Sogard said.
Meadows went deep for the third straight game. Meadows' solo drive in the seventh tied it at 6.
"We don't score like this a lot, but we're in close games all the time," manager Don Mattingly said. "One of the things we're learning is figuring out how to get over that hump and win close games."
Berti came within a homer of hitting for the cycle and stole two bases. He tripled in the ninth but was stranded when Anderson flied out to right.
Miami scored three times in the third. Castro hit a two-run shot, and the other run scored on a double-play sacrifice fly.
Garrett Cooper hit a fly ball that center fielder Kevin Kiermaier caught at the wall. Anderson tried to advance to third and originally was ruled safe. After the call was overturned by a replay review, Castro homered on Jalen Beeks' next pitch.
"The guy missed me on the tag but somehow they get an out out of that," Anderson said. "Even the third baseman (Matt Duffy) told me he missed me on the tag so that one's kind of an enigma. We couldn't find any evidence that I was out there, but I guess MLB did."
Kiermaier hit a fifth-inning grounder about 45 feet up the first-base line and ran into Neil Walker right after the first baseman fielded the ball. Walker, who held on for an out as they both crashed to the ground, departed after the sixth inning with a jammed right index finger.
"Knowing how hard (Kiermaier) runs, my sense of urgency was high, so it's just unfortunate, the timing of when I got the ball and the movement that I made to get in front of him," said Walker, who is day to day. "But it's a baseball play."
Marlins: SS Miguel Rojas, who left Thursday's game with right hip tightness, extended his hitting streak to 10 games with double leading off the first.
Rays: Reliever Jose Alvarado (right oblique strain) is scheduled to start a rehab assignment Sunday with Class A Charlotte and could be back next weekend.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Jeter calls Astros' scandal 'black eye' on baseball
Derek Jeter addresses the Astros' sign-stealing scandal, saying baseball players are always trying to get an edge, but the Astros took it too far.
Yankees' Gerrit Cole strikes out 2 in hitless inning of spring debut
Gerrit Cole struck out two and walked one over a hitless inning in his spring training debut for the New York Yankees against Pittsburgh on Monday night.
Jose Altuve grazed by pitch, Astros booed in first away game of spring
Jose Altuve was loudly booed Monday when he was introduced for his spring training road debut, cheered when he struck out and called a cheater by several fans before he was nicked in the foot by a pitch.
Rangers rookie lefty Brock Burke to miss season with torn labrum
Rangers rookie left-hander Brock Burke will miss the 2020 season because of a torn labrum in his left shoulder.
Altuve nicked by pitch, Astros stars booed on road vs Tigers
Jose Altuve insisted he tuned out the hecklers. He couldn't avoid a pitch that grazed him.
Altuve booed, hit by pitch in spring training debut
In his spring training debut, Jose Altuve hears boos walking up to the plate for his first at-bat. Later in the game, he is hit by a pitch and advances to first.