I was having the problem of Sonos stopping to play from my music library on my Android phone when the phone screen locked. It always happened at exactly the same time intervals. As soon as I would wake the phone, the music started again through the Sonos speaker, and it looked like the app had been playing the music all along.
After reading this string of someone with the same problem at https://en.community.sonos.com/troubleshooting-228999/sonos-stops-playing-from-android-library-never-was-the-case-before-6829163 and someone else on another string suggesting it was Wi-Fi related, I remembered that my android phone has different settings for power management for Wi-Fi.
Here’s the fix in my phone settings that worked for me:
Settings / Wi-Fi settings/ Advanced. Scroll down to View More. Changed Keep Wi-Fi on During Sleep from “While Charging” to “Always”.
Thought I would share in case this could work for others as well.