We extend the recently developed near-field (NF) method to include an arbitrary number of dielectrics. NF assumes that the dipoles and fields respond instantaneously to the density, without retardation. The central task in NF is the solution of the Poisson equation for every time step, which is here done by a conjugate gradient method which handles any dielectric distribution. The optical response of any metal-dielectric system can now be studied very efficiently in the near field region. The improved NF method is first applied to simple benchmark systems: a gold nanoparticle in vacuum and embedded in silica. The surface plasmons in these systems and their dependence on the dielectrics are reproduced in the new NF approach. As a further application, we study a silver nanoparticle-based structure for the optical detection of a "lipid" (i.e., dielectric) layer in water, where the layer is wrapping around part of the metallic nanostructure. We show the ~0.1-0.15 eV shift in the spectrum due to the presence of the layer, for both spherical and non-spherical (sphere+rod) systems with various polarizations.