BEIJING—China made last-minute changes to a proposed foreign-investment law, trying to address U.S. complaints about forced technology transfer and bolster a compromise seen as crucial to striking a trade deal with Washington.

In the past week, the national legislature quietly amended a draft of the law to tighten up channels used to leak intellectual property.

The...