To ensure resilience, systems must be endowed with capabilities for rapid detection, response, and recovery to disruptiveevents. In this paper we focus on faults as disruptive events and use a diagnosis engine for their detection and isolation. In particular we use model-based diagnosis, where the diagnosis engine is provided with a model of the system, nominal values of the parameters of the model and values of some of its inputs and outputs. However, there is no guarantee that the information measured by sensors is sufficient to distinguish between multiple root-causes. We address this challenge using an optimal control approach: we design control inputs such that the similarity between outputs in ambiguous fault modes is reduced. We show that under certain assumptions on the system model, minimizing a similarity metric in terms of outputs is equivalent to increasing the diagnosis certainty. We use an optimization-based approach to input design, where the system model acts as a constraint. We show that by using a surrogate model expressed with constructs endowed with differential operators, we improve the time efficiency of the optimal control problem. We demonstrate our approach on a fuel line system, where feedback control is used to ensure the mass flow rate at the engine follows a prescribed reference. We consider leak faults that affect the fuel lines. We show that under the control inputs generated by the nominal controller, mass flow rate measurements are not enough to accurately isolate leaks. We demonstrate that by using custom inputs that minimize the similarity between the outputs in the ambiguous faults modes, the diagnosis uncertainty is eliminated.