In this work, a compartmental model of disease transmission due to typhoid fever, taking into account both the human-to-human transmission and the environmental route due to bacterial contamination of water resources, has been developed and analyzed. The human population under consideration are subdivided into four classes based on the epidemiological status of individuals with respect to typhoid fever transmission dynamics, these are, susceptible human, carrier humans, infectious humans, and recovered humans. There exist additional compartment which represent the concentration of bacteria in the environment. The proposed model is solved analytically to determine the basic reproduction number \(R_0\) at the disease-free equilibrium, determining the endemic equilibrium, and establishing the stability properties of both equilibria. We use global sensitivity analysis to examine how transmission parameters influence model dynamics and intervention outcomes.. These studies demonstrate how environmental shedding rates, behavioral factors, and pathogenic persistence determine these measures of disease transmission and cost intervention outcomes. We consider four interventions in the model to alleviate typhoid cases, and these are represented by four time-dependent control functions, including improvements in water, sanitation, and hygienic standards; behavior change to discourage the transfer of contaminated food and drinks; search and detection of asymptomatic carriers; and treatment of infectives. An optimal control problem in terms of minimizing both typhoid cases and costs of these interventions has been considered, and Pontryagin’s Maximum Principle has been applied to get the necessary condition of optimality. Numerical analysis reveals that all these interventions result in the reduction of the number of infectious and carrier cases per population, although the extent to which they are reduced differs from one strategy to another. The reduction in disease prevalence in the population comes out to be the highest in the case of treatment of infectious cases when considered individually. When treatment of infectious cases is combined with environmental improvements in terms of water, sanitation, and hygiene, the cumulative number of infections in the population comes out to be reduced by the maximum amount. The result obtained from cost-effectiveness analysis in terms of total cost of the implemented interventions, cumulative number of infections, cumulative number of infections prevented, and mean opportunity cost per person in economics indicates that treatment represents the most cost-effective individual measure in tackling typhoid, while the combined measure represents the measure with the maximum epidemiological gain at a moderate cost increase.