Scott Beyer and his farmhands spend mornings scraping manure off the milking-parlor floor. In the nearby climate-controlled barn, cows are sleeping on water beds and munching on nutritionist-crafted meals while high-tech tags on their legs help monitor their health.

“We try to make them live the high life,” said Mr. Beyer, manager of Kelsay Farms outside Greenwood among the corn and soybean fields of central Indiana.

Many of America’s dairy farmers have decided that a happy cow is a cash cow—that treating their cattle like dairy queens yields more milk. They are playing soothing classical music in milking rooms, firing up fans and sprinklers to mimic spring breezes and treating their cows to robotic back-scratching sessions.

American dairy cows are among the world’s most productive. They produced 10.3 metric tons of milk per animal, on average, in 2016, according to the U.S. Department of Agriculture. That is enough for about 150 people for a year, and an almost 40% larger yield than two decades ago.

While operational efficiency and selective breeding play a big part, farmers and some researchers believe cow-coddling also is critical.