Just to add to balso's (eta and bets) reply
The key with Montpellier beaches is to avoid the ones closest to the public transport links, as they get the most crowded.
Sete is a seaside town with long stretches of soft sand beaches nearby. It is west of Montpellier. Just to note, further away to the west is Cap d'Adge, which is a popular naturalist resort but also has some nice beaches. As called out -- Espiguette is the large, expansive beach nearby and may be one of the best. it retains its somewhat wild character.
Sanary-sur-Mer is popular with the french. Bandol is nearby, and the area is famous for rose wine. A lot of these beaches tend to be very narrow and not nearly the wide expanse of some of the ones called out.
I agree that Hyeres is a charming place to stay -- there are a number of smaller beaches in the towns along the scenic route between Hyeres and Saint Tropez.. Ramatuelle is the petit village near Saint Tropez. The nearby Pampelonne beach is a long stretch of white sand and chic beach clubs. It is famous because it is rather nice, but it is popular. What's I like here is there is no line of concrete buildings backing the beach, despite the services (beach clubs, restaurants, etc)