The aim of the paper is to derive a restricted nonlinear second gradient continuum theory for an elastic material from a periodic lattice structure. Second gradient theory requires the inclusion of second deformation or displacement gradients in addition to first gradients among constitutive variables. The theory is restricted in the sense that the strain energy density obtained is only quadratic in second gradients whereas it depends arbitrarily on first gradients. The material is assumed to have a periodic lattice structure in which particles are situated at certain nodes. A two-body interaction between particles is considered and the associated potential is assumed to depend on a nonlinear strain measure which is related to the difference of the squares of the lengths between nodes after and before deformation. It is also assumed that a particle interacts with a finite number of neighbouring particles. By employing a Taylor series expansion of displacements about nodal points, a strain energy density involving second gradients and valid up to the fourth order of lattice parameter is obtained. The equilibrium equations and boundary conditions are then found by extremizing the total strain energy of the body over all admissible displacement fields. It is shown that the loss of ellipticity of the first gradient theory can be corrected in some cases by second gradients. This makes the localized deformation solutions possible. Explicit calculations are carried out for planar square and hexagonal lattices under homogeneous plane strain.