A novel sharp interface ghost-cell based immersed boundary method has been proposed and its parameters have been optimized against an analytical model in diffusion applications. The proposed embedded constrained moving least-squares (ECMLS) algorithm minimizes the error of the interpolated concentration at the image point of the ghost point by applying a moving least-squares method on all internal nodes, near the ghost image point, and the associated mirrored image points of these internal nodes through the corresponding boundary conditions. Using an analytical model as a reference, the ECMLS algorithm is compared to the constrained moving least-squares (CMLS) algorithm and the staircase model using various grid sizes, interpolation basis functions, weight functions, and the penalty parameter of the constraint. It is found that using ECMLS algorithm in the investigated diffusion application, the incomplete quartic basis function yields the best performance while the quadratic, cubic, and bicubic basis functions also produce results better than the staircase model. It is also found that the linear and bilinear basis functions cannot produce results better than the staircase model in diffusion applications. It is shown that the optimal radius of the region of internal nodes used for interpolation scales with the logarithm of the boundary radius of curvature. It is shown that for the diffusion application, the proposed ECMLS algorithm produces lower errors at the boundary with better numerical stability over a wider range of basis functions, weight functions, boundary radius of curvature, and the penalty parameter than the CMLS algorithm.