Use curtain strapping in front of stalls
We use 2-inch strips of curtain strapping to keep cows from going forward in the face-in free stalls at the Hoard's Dairyman Farm. This polypropylene strapping, which is designed to be used vertically to hold sidewall curtains in place, comes in rolls of 150 feet or longer.
We attach the strapping to concrete end walls using a strap ratchet similar to a load binder for a semi-trailer. The strapping is held in place by barn door pulls mounted on stub posts about every sixth stall.
The strapping will give some as it slides through the door pulls, but is enough of a deterrent to keep cows from going forward and getting caught under the neck rails. We have tried other devices, but found the strapping the lowest-cost solution that's also safe for the cows