Create mask for half of sphere
Use the Object output of Texture Coordinate instead.   

I've also applied a 0.5 offset on the X axis position so the shadow edge is centered on the sphere(this is equal to the value of the position of the 'black' color on the ColorRamp).
It'll now scale correctly when rotated around any axis, since it's reference is centered on the object. 

If you want a softer or harder transition, change the position of the 'black' point on the ColorRamp - make sure not to forget to change the offset on the Mapping node as well.