The match was delayed by rain for several hours before Murray battled hard to save three set points in the tiebreak before Sandgren converted the fourth to end the 74-minute first set when the Brit's volley found the net.
Murray was broken in the opening game of the second set and fell 3-0 behind before breaking back to leave the set poised at 5-5.
But the 28-year-old American broke back and then served out the match to set up a second round clash with Canadian second seed Denis Shapovalov.
"I think there was some good stuff in there," Murray told BBC Sport. "I think my ball striking was better than last week.
"I hit quite a few more winners, came to the net quite a lot. Obviously I didn't win but I do feel I was a bit more in control of what was happening out there.
"Physically I felt OK in the rallies, but I did notice in the second set that my first serve wasn't as good, and I think maybe my legs were a little bit heavy at the end there."
Murray will play no part in next week's US Open having decided to withdraw from the men's doubles and mixed doubles to focus on his singles comeback.
Murray underwent hip surgery earlier this year after a first-round exit at the Australian Open in January, almost causing him to retire from the sport.