Cowboys really did sing cowboy songs to the cattle at night. Singing songs like "Old Dan Tucker," "Nearer My God To Thee," "In the Sweet By and By" or "The Texas Lullaby" soothed jittery cows, which helped reduce the likelihood of stampede.
Thunder and lightning were the most common cause of stampede. At night, if a storm came and the cattle started running, it was the cowboy's job to jump on his horse and get out there in the lead to head them off and round them up safely. It was a dangerous job riding through the dark, with prairie dog holes all around, not knowing if the next turn would be your last.
If it were a clear night with the cattle bedded down and quiet, two men on guard would circle around with their horses on a walk. One man would sing a verse of a song, and his partner on the other side of the herd would sing another verse. They would go through a whole song that way, right through the night.