The main objective of this study was to develop a simple and efficient spectrophotometric technique combined with chemometrics for the simultaneous determination of sulfamethoxazole (SMX) and trimethoprim (TMP) in drug formulations. Specifically, we sought: (i) to evaluate the potential use of rank annihilation factor analysis (RAFA) to pH gradual change spectrophotometric data in order to provide sufficient accuracy and model robustness; and (ii) to determine SMX and TMP concentration in drug formulations without tedious pre-treatments such as derivatization or extraction techniques which are time-consuming and require hazardous solvents. In the proposed method, the spectra of the sample solutions at different pH values were recorded and the pH-spectra bilinear data matrix was generated. On these data, RAFA was then applied to estimate the concentrations of SMX and TMP in synthetic and real samples. Applying RAFA showed that the two drugs could be determined simultaneously with concentration ratios of SMX to TMP varying from 1:30 to 30:1 in the mixed samples (concentration range is 1–30 µg mL−1 for both components). The limits of detection were 0.25 and 0.38 µg mL−1 for SMX and TMP, respectively. The proposed method was successfully applied to the simultaneous determination of SMX and TMP in some synthetic, pharmaceutical formulation and biological fluid samples. In addition, the means of the estimated RSD (%) were 1.71 and 2.18 for SMX and TMP, respectively, in synthetic mixtures. The accuracy of the proposed method was confirmed by spiked recovery test on biological samples with satisfactory results (90.50–109.80%).