Metra reached a tentative agreement with freight railroads and their unions, averting a strike that could have started tonight and halted service on the BNSF and three Union Pacific lines.