Depends on your boss and where you work. I think lots of people & businesses appreciate a bit of extra heads-up above & beyond the required notice period.
Never feel obligated to give more than two weeks, and then only when you're definitely leaving.
Imagine the flip side conversation: "We're thinking about firing you, so we're interviewing people. Not sure, we'll see how it goes. I suppose we might be convinced to keep you if you work an extra 20%."
It's an extremely asymmetric relationship. Recognize which side of that relationship you are on.