It’s a purely literary phrase, a hyperbolic metaphor, used to create a vivid image of a cowboy riding off, successful after a trial of some kind, into the West as the sun sets. read more
ride off into the sunset unknown Origin: from a Western movie cliché, in which the good guy who has arrived in a troubled town and solved whatever grave problem it was experiencing with bad guys, gets on his horse and rides west in the direction of the picturesque setting sun. read more
Typically at the end of the story, a character (usually a cowboy) would be said to be riding into the sunset, meaning that he was leaving the town where the events of the story had taken place. Viewed from a distance, it appeared that he was riding into a sunset. read more