A federal judge on Wednesday ordered Google to retool the system powering its price-gouging monopoly in digital advertising, sparing the company from a wrenching breakup that had been sought by the U.S. government.