BILLY JOEL drank for years to help cope with agonizing hip pain – but his heavy boozing contributed to long-term bone destruction, sources tell The ENQUIRER.

That’s the real story behind the 61-year-old Piano Man’s recent double hip replacement surgery at a Long Island hospital, the sources divulged.

Billy has been in "constant pain for most of his life" due to a congenital condition, and he used alcohol to cope with it, said an insider.

But along with his "bouncing around onstage and riding the vintage motorcycles he loves, the booze was helping to destroy Billy’s bones."

Experts say excessive alcohol use can increase risk of osteoporosis (bone loss) and can cause osteonecrosis (death of bone cells due to decreased blood flow), which often affects the hips.

Dr. Calin Moucha, of the Mount Sinai School of Medicine’s Department of Orthopedics in New York, who did not treat Billy, told The ENQUIRER: "Alcoholism obviously creates a variety of health problems and can cause a hip issue known as osteonecrosis."

Billy has struggled with depression and drinking for years and did rehab stints in 2002 and 2005. In 2007, The ENQUIRER reported that Billy had fallen off the wagon again over troubles with his third marriage to now ex-wife Katie Lee.

"He was caught in a vicious cycle where he’d drink to try and forget his physical and emotional pain," explained the insider.

"But relying on the bottle just made everything worse."

Now, with the hip replacement, Billy – who has the support of second wife Christie Brinkley and their daughter Alexa Ray – "believes he’s finally found the relief he’s been seeking for years."