I just stop if/when I get frustrated or bored; never quite know when that'll happen but it eventually does. I play a lot of Dota 2 and have been solo stacking to try and raise my MMR, and if I ever feel myself get frustrated or a bit salty, I stop playing straight away. You just can't play your best when you're like that, nor is it beneficial to your team's enjoyment or chances at winning, so I just do the right thing and have a break for a while. I like to think I'm a nice player, so if I ever feel the frustration start to build I keep schtum, finish the game, and have a break.
And it's the same case for single-player games, really. Playing Dark Souls right now and on the few occasions I get annoyed at something that happened, like when trying to get back to where I died in Blighttown I got stuck on a pole and one of those fat things knocked me off, I just take a short break. Go make food, something like that.
So my ideal session isn't really a length in time, it's just how long I last before something stops me enjoying the game as much, and depends on the game. I've sat for 10 hours playing some games, and sat for 2 on others.