This may be "And Miles to Go Before I Sleep" (1958) (also known as "But I Have Promises to Keep...") by William F. Nolan, which was first published in Infinity Science Fiction, August 1958 and is available at the Internet Archive.
This story was previously proposed as an answer to this other question (from which the above information is cribbed), but it was not accepted. However, it sounds like a very good match.
The protagonist is an astronaut who contracts an incurable illness (all bolding below is mine):
He had promised his parents that he would come home -- and he meant to
keep that promise.
The doctors had shown him that it was impossible. They had charted his
death; they had told him when his heart would stop beating, when his
breathing would cease. Death, for Robert Murdock, was a certainty. His
alien disease was incurable.
But they had listened to his plan. They had listened, and agreed.
The plan is to have a robot substitute for him on his return voyage:
Murdock smiled. He knew that a machine, however perfect, could not
experience the emotion of sorrow, but it eased him to hear the words.
You will be fine, he thought. You will serve well in my place and my
parents will never suspect that their son has not come home to them.
In the final paragraphs, it is strongly implied that the parents have hatched a similar plan for their son's benefit:
"Well," said a man at the fringe of the crowd, "there they go."
His companion sighed and shook his head. "I still don't think it's
right somehow. It just doesn't seem right to me."
"It's what they wanted, isn't it?" asked the other. "It's what they
wrote in their wills. They vowed their son would never come home to
death. In another month he'll be gone anyway. Back for another twenty
years. Why ruin it all for him?" The man paused, shading his eyes
against the sun. "And they are perfect, aren't they? He'll never