Bosses at Northampton General Hospital NHS Trust had asked for a ruling on what was in the boy's best interests.
A lawyer representing the trust said the child died late on Saturday.
The boy suffered from the most severe type of spinal muscular atrophy - a hereditary condition that affects nerve cells connecting muscles to the brain and spinal cord, Mr Justice Hayden was told.
Specialists said the condition was degenerative and incurable, and the burden treatment placed on the boy outweighed any benefit.
The judge was told the child was put on a ventilator 18 minutes after being born. He was in an intensive care unit all his life and doctors said there was no prospect of him moving off intensive care.
The boy's mother and father argued that he experienced pleasure and said his life had not yet reached the point where it should end.
His mother said he smiled every day and was "amazing" and a "fighter".
Mr Justice Hayden had praised the couple's devotion to the little boy.
Both had made personal pleas to the judge as they asked him to rule that life support treatment should carry on.
"He could have had no more powerful advocate on his behalf than his mum," Mr Justice Hayden told the court.
"His parents have brought sunshine into his life."
But he said evidence showed that pain was a feature of the little boy's day-to-day life.
He added he had to confront not merely the importance of life but also the quality.
And he said the little boy's dignity and autonomy had to be respected.
He said treatment was causing the little boy harm, pain and distress, adding it would be wrong for the life-support regime to continue.
The little boy's mother had suffered a miscarriage before giving birth to him, the judge was also told.
His father had seen a child from a previous relationship die when a few months old.