Sex allocation theory is considered as a touchstone of evolutionary biology, providing some of the best supported examples for Darwinian adaptation. In particular, Hamilton's local mate competition theory has been shown to generate precise predictions for extraordinary sex ratios observed in many separate-sexed organisms. In analogy to local mate competition, Charnov's mating group size model predicts how sex allocation in simultaneous hermaphrodites is affected by the mating group size (i.e., the number of mating partners plus one). Until now, studies have not directly explored the relationship between mating group size and sex allocation, which we here achieve in the simultaneously hermaphroditic flatworm Macrostomum lignano. Using transgenic focal worms with ubiquitous expression of green-fluorescent protein (GFP), we assessed the number of wild-type mating partners carrying GFP+ sperm from these focal worms when raised in different social group sizes. This allowed us to test directly how mating group size was related to the sex allocation of focal worms. We find that the proportion of male investment initially increases with increasing mating group size, but then saturates as predicted by theory. To our knowledge, this is the first direct test of the mating group size model in a simultaneously hermaphroditic animal.