Upgrading to high gain antenna on sensor and/or gateway

Is it OK and beneficial to upgrade the antenna on the gateway and the sensors to higher gain models to get longer communication distance?

Is it best to put upgrade antenna on both the gateway and the sensors, or just the sensors, or just the gateway?

Are there directional antennas that would benefit if the gateway is on one end of a facility vs in the middle?

Yes, you can install them on both ends. I typically recommend this antenna:
https://www.amazon.com/Antenna-Antennas-SyncroBit-Repeater-Antennae/dp/B09D7K986W/ref=sxin_14_pa_sp_search_thematic_sspa?content-id=amzn1.sym.92181fe7-c843-4c1b-b489-84c087a93895%3Aamzn1.sym.92181fe7-c843-4c1b-b489-84c087a93895&crid=1SOH0X1LLE3T3&cv_ct_cx=915mhz%2Bantenna%2Brp-sma&keywords=915mhz%2Bantenna%2Brp-sma&pd_rd_i=B09D7K986W&pd_rd_r=80a73235-c992-477b-9687-929e4f0a01c0&pd_rd_w=lOIvo&pd_rd_wg=DQ8QR&pf_rd_p=92181fe7-c843-4c1b-b489-84c087a93895&pf_rd_r=Z8P11RB34YR4MR6EFM6M&qid=1707427916&sbo=RZvfv%2F%2FHxDF%2BO5021pAnSA%3D%3D&sprefix=915mhz%2Bantenna%2Brp-sma%2Caps%2C172&sr=1-1-364cf978-ce2a-480a-9bb0-bdb96faa0f61-spons&sp_csd=d2lkZ2V0TmFtZT1zcF9zZWFyY2hfdGhlbWF0aWM&th=1

You will see the greatest improvement adding the antenna to the sensor but it doesn’t hurt anything to add it to the Gateway as well.