It’s a lens that connects the focusing and the f/stop rigs based on the “guide number” you select on the bottom of the lens rings for the flash you are presumably using — or rather, that the lens designer thought you’d be using, otherwise you’d just use a regular Nikkor, right? So if your lens is set to a lower guide number, the lens will want to stop focusing at the point where, per the inverse square law, the light from your flash would have fallen off to the point that the subject would not be fully illuminated. So perhaps part of the issue is that the guide number is set to a low number; try increasing it, and see if you can thereby focus further out towards infinity. I’m unsure why the lens would occasionally focus fully out to infinity and then suddenly stop doing so — could it be that in moving the focusing ring back and forth you’re inadvertently disengaging the little fork mechanism that connect the focusing ring to the f/stop ring, and then just as inadvertently re-engaging the fork mechanism?