That was close!

Kourtney Kardashian celebrated the Fourth of July weekend alongside her boyfriend Younes Bendjima and the mother-of-three narrowly avoided a wardrobe malfunction in her racy swimsuit.

Wearing a black high-rise swimsuit that showed serious sideboob, Kourtney looked sexy as she soaked up the sun in St. Tropez on a boat with her 23-year-old boy toy. However, Kourtney's bikini body was almost exposed on more than one occasion during her mini-getaway, as she was seen constantly adjusting the one-piece.

MORE: Kourtney Kardashian and Younes Bendjima Step out Together — and She Looks Half Naked!

Crediting her summer body to her strict detox diet, the KUWTK star has never looked better as she vacationed the Algerian model and friends on the French Riviera.

kourtney kardashian splash

And if the swimsuit looks familiar, that's because Kourtney, 36, raided her younger sister Khloé Kardashian's closet for the $575 Norma Kamali one-piece. Khloé also rocked the sexy swimwear on the paperback cover of her book, Strong Looks Better Naked.

This is the second vacation for Kourtney and Younes, who also spent time together during the Cannes Film Festival last month — and it's getting serious.

kourtney kardashian splash

“After years with Scott, it’s such a refreshing change to be treated so well by Younes,” an insider told Hollywood Life. “Younes is always complimenting Kourtney, telling her how beautiful, funny and smart she is. He even tells her how lucky he is to be dating her.”

MORE: Kourtney Kardashian Shows Scott Disick What He's Missing With This Bedroom Selfie

Meanwhile, her ex Scott Disick was nearly 5,000 miles away in Miami at the 13th annual Irie Weekend Festival alongside rappers Future, T.I., and Lil Yachty. Noticeably missing was Scott's 19-year-old fling Bella Thorne.

View this post on Instagram

Decent weekend

A post shared by Scott Disick (@letthelordbewithyou) on

A source recently claimed the pair had "understanding" for their on and off relationship.

"He and Bella have an understanding," the source told People. "They're just hanging out, hooking up and having fun."

We just have one question — Who's watching Mason, Penelope, and Reign?!

For more photos of the Kardashian's bikini bodies, check out the gallery below!