ohn Sullivan, who wrote one of the best-loved British sitcoms, Only Fools and Horses, has died at the age of 64.
He had been in intensive care for six weeks at a hospital in Surrey, battling viral pneumonia.
He also wrote Citizen Smith and Just Good Friends, and the third and final episode of his latest work Rock & Chips will be shown on BBC One on Thursday.
Sir David Jason, who played Del Boy in Only Fools and Horses, said he was "devastated" at the loss of his friend.
He said: "We have lost our country's greatest comedy writer but he leaves us a great legacy, the gift of laughter. My thoughts at this time are with his lovely family."
Nicholas Lyndhurst, who played Del's brother Rodney, said he was "shocked" and "deeply saddened" and described his friend as "without doubt" Britain's finest TV writer.
He said: "He was a shy and self-effacing man, but had a huge passion for his work and was looking forward to writing more Rock & Chips, I hope the last episode makes him proud."
BBC director general Mark Thompson said: "John had a unique gift for turning everyday life and characters we all know into unforgettable comedy."
The son of a plumber, he is survived by his wife Sharon and two sons, a daughter and two grandchildren.
'Heartfelt comedy'
Gareth Gwenlan, a producer of Only Fools and Horses, said his widow was "obviously devastated" and had her family around her.
The Corporation's head of comedy Mark Freeland added: "No-one understood what made us laugh and cry better than John Sullivan.
"He was the Dickens of our generation. Simply the best, most natural, most heartfelt comedy writer of our time."
He added: "Everything he wrote was basically about his life and the absurdities he faced, and the great characters he met.
"And they just struck a resonance with everyone in the nation - you don't get an audience of over 23 million people if you're not doing something right, and chiming bells with a huge amount of people."
BBC creative director Alan Yentob said there was a beauty to his scripts and the Trotter family would provide enjoyment, tears and laughter for generations to come.
Stephen Fry said he was "terribly saddened" by the news and described him on Twitter as "one of the great comedy writers of our time".
Only Fools and Horses - starring David Jason and Nicholas Lyndhurst as south London brothers Del and Rodney Trotter forever trying to make a quick fortune - was regularly voted Britain's favourite sitcom.
It ran for 10 years between 1981 and 1991, with several Christmas specials in the years that followed.
The 1996 special Time On Our Hands, which was billed as the final episode and saw Del Boy come good on his ambition to make himself and Rodney millionaires, was watched by more than 24 million people, a record for a sitcom in the UK.
The demand for follow-ups saw Sullivan eventually relent and return to the story of the Trotters from 2001 for occasional Christmas specials.
He also wrote a spin-off - The Green Green Grass, featuring Only Fools characters Boycie and Marlene - and a prequel, Rock & Chips, which documented Del Boy's early life.
Another show written by Sullivan, Just Good Friends, proved popular in the 1980s. It starred Paul Nicholas and Jan Francis as former lovers who meet up again five years after he jilted her.
John Sullivan, who was born in Balham, south London, in 1946, and always said his secret was that he wrote about what he knew, got his first job at the BBC as a scenery hand aged 16.
During his spare time he wrote sketches and got his first break when he submitted a script to well-known comedy producer Dennis Main Wilson, who loved it.
He was commissioned to write more episodes, given three months' paid leave, and ended up with Citizen Smith - a comedy starring Robert Lindsay as the young communist "Wolfie" Smith.
He once described Rodney from Only Fools and Horses as a "teeny bit me" because he was also a bit of a "naive dreamer" as a teenager.
And he said Del Boy was an amalgam of many characters he came across while working in the second-hand car trade in the 1970s.
He was appointed an OBE in 2005 for services to drama.
BBC News - Only Fools and Horses writer John Sullivan OBE dies
Awful news. Only Fools was and always will be one of the greatest ever comedies. RIP.
He had been in intensive care for six weeks at a hospital in Surrey, battling viral pneumonia.
He also wrote Citizen Smith and Just Good Friends, and the third and final episode of his latest work Rock & Chips will be shown on BBC One on Thursday.
Sir David Jason, who played Del Boy in Only Fools and Horses, said he was "devastated" at the loss of his friend.
He said: "We have lost our country's greatest comedy writer but he leaves us a great legacy, the gift of laughter. My thoughts at this time are with his lovely family."
Nicholas Lyndhurst, who played Del's brother Rodney, said he was "shocked" and "deeply saddened" and described his friend as "without doubt" Britain's finest TV writer.
He said: "He was a shy and self-effacing man, but had a huge passion for his work and was looking forward to writing more Rock & Chips, I hope the last episode makes him proud."
BBC director general Mark Thompson said: "John had a unique gift for turning everyday life and characters we all know into unforgettable comedy."
The son of a plumber, he is survived by his wife Sharon and two sons, a daughter and two grandchildren.
'Heartfelt comedy'
Gareth Gwenlan, a producer of Only Fools and Horses, said his widow was "obviously devastated" and had her family around her.
The Corporation's head of comedy Mark Freeland added: "No-one understood what made us laugh and cry better than John Sullivan.
"He was the Dickens of our generation. Simply the best, most natural, most heartfelt comedy writer of our time."
He added: "Everything he wrote was basically about his life and the absurdities he faced, and the great characters he met.
"And they just struck a resonance with everyone in the nation - you don't get an audience of over 23 million people if you're not doing something right, and chiming bells with a huge amount of people."
BBC creative director Alan Yentob said there was a beauty to his scripts and the Trotter family would provide enjoyment, tears and laughter for generations to come.
Stephen Fry said he was "terribly saddened" by the news and described him on Twitter as "one of the great comedy writers of our time".
Only Fools and Horses - starring David Jason and Nicholas Lyndhurst as south London brothers Del and Rodney Trotter forever trying to make a quick fortune - was regularly voted Britain's favourite sitcom.
It ran for 10 years between 1981 and 1991, with several Christmas specials in the years that followed.
The 1996 special Time On Our Hands, which was billed as the final episode and saw Del Boy come good on his ambition to make himself and Rodney millionaires, was watched by more than 24 million people, a record for a sitcom in the UK.
The demand for follow-ups saw Sullivan eventually relent and return to the story of the Trotters from 2001 for occasional Christmas specials.
He also wrote a spin-off - The Green Green Grass, featuring Only Fools characters Boycie and Marlene - and a prequel, Rock & Chips, which documented Del Boy's early life.
Another show written by Sullivan, Just Good Friends, proved popular in the 1980s. It starred Paul Nicholas and Jan Francis as former lovers who meet up again five years after he jilted her.
John Sullivan, who was born in Balham, south London, in 1946, and always said his secret was that he wrote about what he knew, got his first job at the BBC as a scenery hand aged 16.
During his spare time he wrote sketches and got his first break when he submitted a script to well-known comedy producer Dennis Main Wilson, who loved it.
He was commissioned to write more episodes, given three months' paid leave, and ended up with Citizen Smith - a comedy starring Robert Lindsay as the young communist "Wolfie" Smith.
He once described Rodney from Only Fools and Horses as a "teeny bit me" because he was also a bit of a "naive dreamer" as a teenager.
And he said Del Boy was an amalgam of many characters he came across while working in the second-hand car trade in the 1970s.
He was appointed an OBE in 2005 for services to drama.
BBC News - Only Fools and Horses writer John Sullivan OBE dies
Awful news. Only Fools was and always will be one of the greatest ever comedies. RIP.