David Ferrer booked his place in the final of the ATP Sony Open with a hard-fought 4-6 6-2 6-3 victory over Tommy Haas in Miami.