The Astros took a 2-0 lead through four innings, but Baltimore scored six times over the next three frames to reach the 60-win mark.
McLouth singled in the first of Baltimore's three runs in the fifth, Manny Machado also had an RBI base hit in the inning and Nick Markakis contributed a sacrifice fly.
Bud Norris (7-9), sent from Houston to Baltimore prior to the trade deadline, got the win against his former team by giving up two runs on four hits in six innings. He struck out eight.
Jim Johnson worked around a walk in the ninth inning to earn his 37th save.
Jordan Lyles (4-5) was charged with the loss after allowing three runs on nine hits in 5 2/3.
Nativity scenes to be moved at Guantanamo after troops' protest
S. Carolina GOP Governor Nikki Haley breaks wood with hands [VIDEO]