Known by its advantages, a proportional-integral controller (henceforth – a PI controller) with variable or switchable parameters, related to a class of controllers with a variable structure ((henceforth – variable structure controllers, VSC) that do not use a sliding mode, is applied to control an object in the automatic system with a sufficient delay, reducing the performance quality of standard controllers (integral, proportionally integral, proportionally integral differential). The specifics of building this controller makes it more difficult to use analytical approaches to the parametric optimization of the system, which defines the use of algorithmic methods. The present work uses a gradient algorithm, in which the gradient constituents are calculated with the help of sensitivity functions with their definite advantages. To obtain initial values of VSC adjustable parameters, an adjustment method of a standard PI controller based on the internal model controller (IMC) is used. The gradient algorithm of an automatic parametric optimization (henceforth – an APO algorithm) has calculated optimal parameters of VSC starting from the closeness of the output coordinate of the object to the reference process with a minimum of the integral quadratic criterion. The correctness of the calculated vector of the controller adjustment by the formed APO algorithm is confirmed by necessary and sufficient extremum conditions of the chosen optimization criterion.