Rahm, looking to become the first three-time winner of the event since Seve Ballesteros, birdied four of his last seven holes to post a four-under 67 at Club de Campo Villa de Madrid.
That took his total to 10 under par, leaving him just two shots behind the leading duo heading into the weekend.
"I played 11 unconformable holes and then played really good golf in the last seven," Rahm said. "It seems to be the part of the golf course where I tend to score on more often, so I hope to get a little bit better on the front nine the next few days."
Englishman Waring birdied four of his last five holes to post the best round of the day, an eight-under-par 63.
That was good enough for a share of the lead on 12 under alongside Scotland's Gallacher, who carded his second consecutive 65 to join Waring at the top.
"I hit some alright shots," said Waring. "I actually got the putter quite hot which is not like me at all really, so it was nice to hole a few long ones coming in and keep that momentum I had going during the round, so happy with that finish definitely.
"I really enjoy this golf course, it suits me. I am staying aggressive with driver and it's giving me a lot of chances with wedges, which is one of the strong parts of my game. So it's giving me chances and then I capitalised with the putter which is ideal.
South Africa's Hennie du Plessis and another Scot, David Drysdale, share third place a shot further behind, after both shot 66s on Friday.
Rahm follows in a tie for fifth a shot behind, alongside the likes of Min Woo Lee, Kiradech Aphibarnrat and Matthieu Pavon.
Defending champion Rafa Cabrera Bello and last year's runner-up Adri Arnaus both missed the cut on home soil.