The game saves progress when the in-game day ends, i.e., when the farmer goes to bed, collapses from exhaustion, or collapses at 2am. All progress during a day is lost if the player quits the game without ending the day. In multiplayer, the game saves after all players click through the prompts...
stardewvalleywiki.com