To protect their child from her. Nick sees no other way. This is explained near the end:
Margo: You could get custody.
Nick: No, I won't. And you know it. It's going to be my child. I'm not going to leave it.
Margo: You want to stay.
Nick: I have a responsibility. It's not about what I want anymore.
Amy pretty much states what'll happen to the child if Nick leaves:
Amy: I won't have to teach your child to hate you. He'll do that all by himself.
The novel ends pretty much the same way, with Nick reaching the same conclusion. He can't leave their child with this sociopath, he probably won't get cudstody and he can't harm Amy and get away with it, after all that's happened. Once again, Amy had planned well.