It's not necessary in #1 (if you had numbered them), but it marks a convenient place to break up a long sentence and is where you'd take a breath if you were speaking it. In #2, 'tossing and turning' is parenthetical (with a comma before and after). If you omit that phrase you wouldn't need a comma before 'before'.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
ryansamturnerSo 1 & 3 are optional really?I would say so, and nobody has disagreed with me so far.