Ben Affleck could really use a hug.

On Friday, the actor-turned-director’s estranged wife, Jennifer Garner, was on the brink of finally filing for divorce — nearly two years after the Hollywood power couple announced their split over allegations that he bedded their nanny.

On top of that, Affleck, 44, doesn’t want to play Batman anymore, his last movie bombed and his brother, Casey, seems to be getting all the ­attention right now thanks to his critically acclaimed role in “Man­chester by the Sea.”

Needless to say, it’s been a difficult time for Boston-native Ben.

It all started last year following the release of “Batman v Superman: Dawn of Justice.” While critics praised Affleck’s ­debut performance as the Dark Knight, they panned the movie itself — and the brutal ­reviews seemed to take their toll.

During a promotional interview with co-star Henry Cavill, Affleck was caught on tape looking devastated. The display of dread sparked a viral video, dubbed “Sad Affleck,” which featured an audio track of ­Simon and Garfunkel’s “The Sounds of Silence.”

Weeks and months went by before the next bump in the road came, in the form of the critically despised DC movie “Suicide Squad.” At the London premiere in August, sources told Page Six that Affleck was spotted looking disheveled following a heavy night of partying.

Affleck was questioned at great length about donning the iconic cape-and-cowl during a press tour and was also hammered for details about his stand-alone “Batman” movie and “Justice League,” which are slated to come out this year.

His movie “Live By Night” wound up tanking at the box office — leaving Warner Bros. with a $75 million loss, ­according to Variety.

The Prohibition-era gangster flick, adapted from a Dennis Lehane novel, made a measly $16.5 million globally, despite its $65 million production budget. The film had been a pet project for Affleck, with him taking the helm as director, writer, producer and star.

Warner Bros. ultimately thought the movie would be a hit after backing some of Affleck’s previous, very successful efforts such as “The Town” and “Argo” — the latter of which won him the Oscar for Best Picture in 2013.

After counting his losses, Affleck began focusing on his role as the Caped Crusader — but not before being brought back down to earth yet again in early January when Casey in his Golden Globes acceptance speech neglected to thank his older brother.

“I was a little taken aback,” Ben joked during a TV interview on “Jimmy Kimmel Live!”

Ben Affleck and Jennifer GarnerBauer-Griffin

In comparison, when Ben won the Best Screenplay Oscar for 1997’s “Good Will Hunting,” he chose to thank his bro — even though Casey had only a minor role in the film.

The sad times continued to roll for Ben in January, after Page Six revealed he had been spotted in Beverly Hills accompanied by a 24-hour medical in-home detox aide. After his split from Garner in 2015, reports had emerged that he had been ­addicted to alcohol and gambling.

Photos obtained by the Daily Mail showed a bloated and grizzled Affleck walking alongside the aide — identified as Elizabeth Weaver, founder of the boutique care-giving service Concierge Nursing Care.

A few more weeks passed and all seemed calm on the Affleck front — until a bombshell revelation this week: the “Batman” star wants to hang up the suit.

Insiders at Warner Bros. told Collider Movie Talk that Affleck “doesn’t want to be Batman anymore” and that he had been “talking with Warner Bros. in an attempt to get out of” playing the part.

On Friday, it was reported that Garner was getting ready to finally file for divorce from Affleck. The couple split after 10 years of marriage amid reports that Ben had been cheating on the “Juno” actress with their nanny.

Affleck has come a long way professionally since the dark days of the early 2000s, when he starred in cringe-worthy films such as “Daredevil,” “Gigli,” “Jersey Girl” and “Surviving Christmas.”