We show that dark matter halos in N-body simulations have a boundary layer (BL), which neatly separates dynamically bound mass from unbound materials. We define T(r) and W(r) as the differential kinetic and potential energy of halos and evaluate them in spherical shells. We notice that in simulated halos such differential quantities fulfill the following properties: (1) the differential ratio = -2T/W has at least one persistent (resolution-independent) minimum , such that, close to , (2) the function w = -d log W/d log r has a maximum, while (3) the relation () w() holds. BLs are set where these three properties are fulfilled, in halos found in simulations of tilted Einstein-de Sitter and ΛCDM models, run ad hoc, using the ART and GADGET codes; their presence is confirmed in larger simulations of the same models with a lower level of resolution. Here we find that ~97% of the ~300 clusters (per model) we have with M > 4.2 × 1014 h-1 M☉ own a BL. Those clusters that appear not to have a BL are seen to be undergoing major merging processes and to grossly violate spherical symmetry. The radius ≡ rc has significant properties. First of all, the mass Mc it encloses almost coincides with the mass Mdyn, evaluated from the velocities of all particles within rc, according to the theorem. Also, materials at r > rc are shown not be in equilibrium. Using rc we can then determine an individual density contrast Δc for each virialized halo, which we compare with the virial density contrast Δv 178Ω (where Ωm is the matter density parameter) obtained assuming a spherically symmetric and unperturbed fluctuation growth. As expected, for each mass scale, Δv is within the range of values Δc. However, the spread in Δc is wide, while the average Δc is ~25% smaller than the corresponding Δv. We argue that the matching of properties derived under the assumption of spherical symmetry must be a consequence of an approximate sphericity, after violent relaxation destroyed features related to ellipsoidal nonlinear growth. On the contrary, the spread of the final Δc is an imprint of the different initial three-dimensional geometries of fluctuations and of the variable environment during their collapse, as suggested by a comparison of our results with the Sheth & Tormen analysis.