Lacey Spears, 27, of New York, administered salt into her son Garnett's feeding tube from infancy while writing a blog about his illness.
Prosecutors described her actions as evil, inhuman and despicable.
The judge said she was suffering from a rare mental disorder and so was spared the maximum 25-year sentence available.
Garnett died in 2014 at Westchester Medical Centre after he was treated for gastrointestinal symptoms that Spears had induced.
His feeding tube had been in place since infancy when Spears told doctors he could not keep food down.
When she took him to hospital saying he was having seizures, doctors found his sodium levels to be extremely high.
The prosecution said that having administered him salt at their home in suburban New York, she twice took Garnett into a bathroom at the hospital to do the same.
They said she posted pictures of him dying on her Facebook account.
Acting state supreme court justice Robert Neary called Spears' crime "unfathomable in its cruelty'', bringing Garnett "five years of torment and pain".
Assistant district attorney Doreen Lloyd said: "She continued to portray him as a sick child for her own bizarre need for attention.
"She used that feeding tube as a weapon to kill him."
Spears had told investigators that her son, whose father was killed in a car accident, suffered from a number of medical problems from Crohn's disease and Celiac diseases to ear abnormalities.
The judge described her as mentally ill and identified her condition as Munchausen by proxy syndrome, in which a person, usually a parent, sickens a child to gain attention from the child's plight.
Her defence lawyers had refused to raise the disorder as a defence and said she had not been diagnosed with any mental illness.
They had asked for the minimum sentence of 15 years. They have filed an appeal against her conviction.
A US woman has been sentenced to 20 years in prison for making her five-year-old son sick and eventually killing him to gain attention online.