Thirty-one defendants, including senior military officers, were each given four life sentences at Wednesday's trial in the southwestern city of Mugla, the private Dogan news agency reported.
Mugla is near the luxury resort where Erdogan and his family narrowly escaped a team of rogue soldiers who stormed his hotel during the night of the coup on July 15, 2016.
They include Gokhan Sahin Sonmezates, a former brigadier general who was accused of directing the plot. Former elite commando Zekeriya Kuzu, who was famously found hiding in a cave four days after the failed coup, also received a life term.
A further nine defendants each received a single life sentence, Dogan added.
Another key figure in the trial, Erdogan's former military aide-de-camp Ali Yazici, was sentenced to 18 years in jail. Just one suspect out of 47 in total, former lieutenant colonel Huseyin Yilmaz, was acquitted.
Some verdicts have already been handed out in lower-profile cases, but this is the first ruling involving alleged top plotters.
"The president's life was at stake that night - not only his actually but all his family because in that southwestern city Mugla he was on vacation with his family: his daughters, sons-in-law and grandchildren," Sinem Koseoglu, Al Jazeera's Turkey correspondent, said.
"Erdogan is the plaintiff of this lawsuit against this 'assassination team'."
The failed coup left 249 people dead, not including the coup plotters, and the authorities have vowed that no compromise will be made in bringing those involved to justice.
During the night of the coup attempt, two police officers were killed while guarding Grand Yazici Hotel in the Mediterranean port town of Marmaris, where Erdogan had been holidaying with his family,
Guzel Eker, the mother of one of the two officers, Nedip Cengiz Eker, described her relief and pain at the verdict.
"I am burning inside. It is enough for me that they have been given life sentences," she said, quoted by state-run Anadolu news agency.
Erdogan has said the assassination plot left him minutes from death after he fled the hotel and went back to Istanbul by plane.
"If I had stayed 10 or 15 additional minutes there, I would have been killed, or I would have been taken," Erdogan told CNN in an interview just days after the coup.
Turkey's prisons full
More than 50,000 people have been arrested under the state of emergency imposed following the coup bid.
"The prisons in Turkey are at capacity, they're full," Al Jazeera's Koseoglu said.
"There are thousands of people inside waiting for their trials to be heard and the verdicts to be announced -even the courthouses sometimes are not enough for those big trials."
Turkey accuses US-based Muslim scholar Fethullah Gulen of orchestrating the attempted coup. Gulen, a former Erdogan ally turned foe, strongly denies Ankara's claims.
Some of the suspects, including Sonmezates, admitted to taking part in the coup bid during the trial but denied any links to Gulen.
Gulen was also on trial in absentia in Mugla. But the judge separated his case from the trial along with two other suspects.
Ravza Kavakci Kan, ruling Justice and Development Party deputy leader, praised the judicial process after hearing the verdict in court.
"This gives us hope that the courts are delivering verdicts after this ugly, treacherous coup attempt," she said, quoted by Anadolu.
One of the lawyers representing the prime ministry, Halit Cokan, said the verdict stemmed from an "open trial" and demonstrated "Turkey was a state with the rule of law".