The lyrics are modeled after a poem William Shakespeare Hays, who wrote such standards as "The Little Old Log Cabin in the Lane," and "Molly Darling" and "The Drummer Boy of Shiloh."
Hays' poem (published in 1886) begins:
Life is like a crooked railroad,
And the engineer is brave,
Who can make a trip successful
From the cradle to the grave,
There are stations all along it,
Where at almost any breath
You'll be "flagged" to stop your engine
By the messenger of death. You may run the grades of trouble,
Many days and years of ease,
But time my have you side-tracked
By the switchman of disease.
You may cross the bridge of manhood,
Run the tunnel dark of strife,
Having God for your conductor
On the lightning train of life.
Always mindful of instructions
Watchful duty never lack
Keep your hand upon the throttle
And your eye upon the track.
The earliest known recording is on an Edison cylinder by Edward Allen and Charles Hart about 1918.
"A grim hint of the turn-of-the-century popularity of 'Life's Railway to Heaven' occurs in Gene Fowler's account of the 1902 trial of Tom Horn of Cheyenne for the murder of Willie Nickell. Charlie and Frank Irwin, two friends of Tom, offer to sing him a last song as he waits at the gallow to be hanged. Horn requests 'Keep Your Hand upon the Throttle and Your Eye upon the Rail,' and the brothers oblige with two and a half stanzas, close to the original Abbey-Tillman text." (p. 615)