In this paper, a new optimal fourth-order 21-point finite difference scheme is proposed to solve the 2D Helmholtz equation numerically, with the technique of matched interface boundary (MIB) utilized to treat boundary problems. For the approximation of Laplacian, two sets of fourth-order difference schemes are derived firstly based on the Taylor formula, with a total of 21 grid points involved. Then, a weighted combination of the two schemes is employed in order to reduce the numerical dispersion, and the weights are determined by minimizing the dispersion. Similarly, for the discretization of the zeroth-order derivative term, a weighted average of all the 21 points is implemented to obtain the fourth-order accuracy. The new scheme is noncompact; hence, it encounters great difficulties in dealing with the boundary conditions, which is crucial to the order of convergence. To tackle this issue, the matched interface boundary (MIB) method is employed and developed, which is originally used to accommodate free edges in the discrete singular convolution analysis. Convergence analysis and dispersion analysis are performed. Numerical examples are given for various boundary conditions, which show that new scheme delivers a fourth order of accuracy and is efficient in reducing the numerical dispersion as well.