Lester (9-13) had never lost to the Orioles, posting a 14-0 career record in 20 starts with a 2.49 earned run average.
Wieters put Baltimore ahead in the fourth with a two-run single and he added an RBI double during a two-run sixth.
The Orioles won their fifth straight and remained a game behind the New York Yankees in the American League East pennant race. New York kept its lead thanks to a 2-1, 10-inning victory over Oakland.
Baltimore and Oakland hold down the two AL wild card positions.
Rookie Miguel Gonzalez (7-4) was credited with the win, allowing two runs on seven hits in 6 1/3. Darren O'Day retired all five men he faced in relief of Gonzalez and Jim Johnson established a franchise single-season record by earning his 46th save.