His Majesty King Bhumibol Adulyadej passed away at Siriraj Hospital at 3.52pm on Thursday, the Royal Household Bureau announced.
His Majesty passed away peacefully at Chalermphrakiet Building of Siriraj Hospital in Bangkok it was announced in a national broadcast.
All royal family members were in attendance at the time.
His Majesty was 88 and would have turned 89 on Dec 5 this year.
- See also: One-year mourning period set
The ninth King of the Chakri Dynasty ascended to the throne on June 9, 1946 and was the world's longest-reigning monarch. People across the country celebrated the 70th year of his accession to the throne this year.
Well-wishers in pink and yellow had been flocking to the hospital to pray for him since the RHB announced on Sunday night that the King's condition was "unstable".
The bureau said in another statement on Monday that His Majesty's general condition was still not stabilised and royal doctors were giving him medication.
An even larger crowd began gathering at Siriraj Hospital on Tuesday, and rapidly grew over the next two days.
The crowd gave alms to monks and prayed continuously for the King's good health. Government offices throughout the nation opened their doors for similar activities on Thursday, and people in all provinces began streaming in to pray and sign their names and best wishes for His Majesty's recovery.