A felon who admitted Monday to breaking into homes in the Elmwood Village and Linwood neighborhoods faces up to 50 years in prison, according to the Erie County District Attorney’s Office.

Dale Gabler, 39, of no permanent address, pleaded guilty to four counts of second-degree burglary.

He broke into the homes between Sept. 1 and Oct. 1, taking money, credit cards, computers and other items as the residents slept. He also stole their car keys and then stole their vehicles, District Attorney Frank A. Sedita III said.

Gabler tried to break into the home of an assistant district attorney, but he was foiled by the prosecutor’s “vigilant watchdog,” Sedita said.

Gabler spent the proceeds of his crimes to pay for his crack cocaine habit, Sedita said.

Buffalo Police Detectives Tim Rooney, Sean Buth and John Paradowski solved the case, according to the District Attorney’s Office.

Gabler is scheduled to be sentenced Jan. 13 by State Supreme Court Justice Penny M. Wolfgang.