The Orioles had won their four previous games, during which they had allowed a total of four runs.
Baltimore took a 1-0 led in the first, but Oakland struck for three runs in the second against Jake Arrieta (1-2).
Kila Ka'aihue drew a one-out walk and scored the tying run on a two-out double by Kurt Suzuki. Sogard then hit a 3-2 pitch over the wall in right to give the A's the lead.
It was Sogard's third career homer, produced in 43 games scattered over three seasons.
Brandon McCarthy (1-3) made the early Oakland advantage stand up while allowing two runs on five hits in seven innings. Despite having lost his first three games of the season he came into the game with a 3.38 ERA.
Josh Reddick padded the Oakland lead with a solo homer in the sixth and an RBI single in the eighth.
Grant Balfour walked one in the ninth en route to his sixth save.
2014: NFL Cheerleaders [PHOTOS]
Michael Sam cut from the Dallas Cowboys