We calculate the next to the leading order Casimir effect for a real scalar field, within $phi^4$ theory, confined between two parallel plates in three spatial dimensions with the Dirichlet boundary condition. In this paper we introduce a systematic perturbation expansion in which the counterterms automatically turn out to be consistent with the boundary conditions. This will inevitably lead to nontrivial position dependence for physical quantities, as a manifestation of the breaking of the translational invariance. This is in contrast to the usual usage of the counterterms in problems with nontrivial boundary conditions, which are either completely derived from the free cases or at most supplemented with the addition of counterterms only at the boundaries. Our results for the massive and massless cases are different from those reported elsewhere. Secondly, and probably less importantly, we use a supplementary renormalization procedure, which makes the usage of any analytic continuation techniques unnecessary.