International Paper Co. has agreed to acquire Temple-Inland Inc. after raising its offer to $3.7 billion, ending a three-month battle for control of the shipping-box manufacturer.