We prove trace and extension results for Sobolev-type function spaces that are well suited for nonlocal Dirichlet and Neumann problems including those for the fractional p-Laplacian. Our results are robust with respect to the order of differentiability. In this sense they are in align with the classical trace and extension theorems.