What you can do is compare the X position of your character to X of the window (viewport) / 2.
With this logic, if the X position of your character is greater or equal half of the X viewport, he'll be on the right, so set the camera to follow. If his X position is lower than half of the X of the viewport, he'll be on the left, so set the camera to stop following.
Good luck!