SUMMARYA quasi optimal finite difference method (QOFD) is proposed for the Helmholtz problem. The stencils' coefficients are obtained numerically by minimizing a least-squares functional of the local truncation error for plane wave solutions in any direction. In one dimension this approach leads to a nodally exact scheme, with no truncation error, for uniform or non-uniform meshes. In two dimensions, when applied to a uniform cartesian grid, a 9-point sixth-order scheme is derived with the same truncation error of the quasi-stabilized finite element method (QSFEM) introduced by Babuška et al. (Comp. Meth. Appl. Mech. Eng. 1995; 128:325-359). Similarly, a 27-point sixth-order stencil is derived in three dimensions. The QOFD formulation, proposed here, is naturally applied on uniform, non-uniform and unstructured meshes in any dimension. Numerical results are presented showing optimal rates of convergence and reduced pollution effects for large values of the wave number.