Keep just one water bottle in the door, and move it all the way to the left (nearest the door hinges). This reduces the speed at which the bottle moves when you open the door: excessive speed causes the bottles to fall over.
Put the rest of the bottles in the bottle rack.
The reason the bottles fall over, is that they have room to wobble. The tray is much wider than the bottle diameter.
If you fill the space between the bottle and the front wall of the tray, the bottle will have no room to wobble and fall over. I've called this a "bottle holder" in the image below. You could build this from cardboard, wood or whatever you have lying around.
Bottles also work, as long as they fill all of the available space and leave no room for a bottle to wobble. From your image, 4 bottles isn't quite enough, you need another one (perhaps smaller in diameter) to fill the remaining space.
The shelf appears to be too wide.
HACK: Make the shelf narrower.
Make and use a divider from an elastic bungee cord or a large elastic band.
Stretch and place a loop around the whole door shelf to form a "front" and "back" row. While the elastic separator will "give" enough to tuck a bottle either in front or behind it, it will (or should be) strong enough to keep an unstable bottle upright.
The ones I would suggest are about 2 cm wide and stretch up to a metre. I don't know for what use they were originally intended—I have a few I use for holding parts for glueing.
It will (or should) also stretch enough to keep its "friends" (milk and juice) close-by on either side well-heeled.
As Hobbes pointed out, the bottles fall over because they have room to wobble. So pack the empty space in the door shelf with other things from your fridge (like bottles of condiments). When you get a new large bottle of water / milk / juice, take out the smaller bottles to make room for it, and put those smaller bottles back on the stationary fridge shelves where you usually keep them.
There are so many things being shipped, various kinds of packing materials have become common.
Fold a sheet of bubble-wrap in half with the bubbles facing inward. Use the resulting chubby, light, flat shelf-space-filler to put behind the heavy water bottle(s) so it/they don't wobble around.
You might want to stick a couple of "pillow paks" between bottles to make a snug fit.
Rubber bands. Preferably those of larger sizes that's not too elastic. Just wrap one around a bottle that doesn't have the rounded bottom and the water bottle. (or two rubber bands knotted together, if needed) The likelihood of someone forcing the fridge door open hard enough to knock over two bottles, should be minimal.
I've never tried this in a fridge, but often did this on camping trips and such. My bottles survived the journey on country roads in an upright position.