Identifying the optimal azimuth and inclination for wellbore drilling in sandy formations can be considered a valuable aid in reducing sand production risks, lost time, and decreasing drilling costs in the petroleum industry. Therefore, a numerical systematic approach was provided to predict sand production in wellbore SDX-5, drilled in a deep-water sandstone reservoir in the Shah-Deniz gas field (South Caspian Basin), which has never been done previously. Additionally, this systematic approach uses geomechanical and geodynamical criteria, along with petrophysical information (density and sonic log) and tectonic characteristics of the study area, which are influenced by the active tectonic stresses of the Apsheron-Balkhan zone. The subsurface data sources employed are more eco-friendly, available, and continuous than experimental tests. The computations conducted achieved azimuth, inclination, polar, and depth profile plots for the Lower Balakhany Formation. The calculations reveal that the optimum azimuth for the wellbore drilling trajectories is parallel to SHmax and oblique drilling to near horizontal is the result of optimum inclination. Polar plots showed optimum azimuth, inclination, and effect of wellbore trajectory on critical collapse pressure and collapse drawdown pressure with pressure values simultaneously, which identify safer alternatives for achieving higher petroleum production rates without sanding. Depth profile plots provide a simultaneous overview of the values of critical collapse pressure, critical sanding pressure for instantaneous drawdown, and optimum wellbore production pressure during drilling and production operations. Moreover, optimum reservoir fluid production (maximum discharge) rates can be identified and imposed as upper limits to prevent sand production.