Getty Composite

Ben Affleck Happy Bday, J Lo ... I Bought A House to Celebrate!!!

Ben Affleck secured his new digs at the same time Jennifer Lopez celebrated a milestone ... 'cause he officially snatched up his lavish mansion while J Lo blew out her candles.

TMZ has confirmed Ben received his own little present on the same day Lopez turned 55 -- closing escrow on his $20 million Los Angeles mansion.

Worth noting ... Jennifer made her own real estate move on her bday too, finalizing the sale of her NYC condo on the same day -- selling her four-bedroom, 7.5-bath duplex in the Big Apple for $23 million after years of searching for a buyer.

She also had time to post a smokin' hot thirst trap on her 55th ... so, the woman's got multitasking down.

TMZ broke the story ... BA purchased the five-bedroom six-bathroom Pacific Palisades home, complete with a den, walk-in closets, media room, powder room and guest house, for $20.5 million -- a move that makes divorce from Lopez seemingly inevitable.

There's one piece of business for the couple still outstanding ... the couple's $68 million mansion. It's still on the market -- and, at this point, the couple's clearly trying to get rid of it because the price tag means they'll barely break even.

The two got divorce rumors swirling back in May ... and, we reported in early June it looked like the couple were heading for Splitsville before J Lo ran off to Europe to vacay with friends.

TMZ Studios

We break down the whole uncoupling in our series "TMZ Investigates: J Lo & Ben: Missed Warning Signs" available to stream on Hulu.

Click here for info about our online advertising practices.