Dam the river just north of the border and let it back up into Mexico.
A border w\a\l\l\dam to keep all the sewage on the Mexican side of the border. As for any extra water diverted there, subtract it from their Colorado River allotment. And, out of fairness, also build a retaining wall along the edge of SF to keep their sewage from polluting the bay.