Suspensions of solid particles in liquids are often made to flow in devices with characteristicdimensions comparable to that of the suspended particles, the so-called confined situation, as in thecase of several microfluidic applications. Combination of confinement with viscoelasticity of thesuspending liquid can lead to peculiar effects. In this paper we present the first 3D simulation of thedynamics of a particle suspended in a viscoelastic liquid under imposed confined shear flow. The fullsystem of equations is solved through the finite element method. A DEVSS/SUPG formulation with alog-representation of the conformation tensor is implemented, assuring stable and convergent resultsup to high flow rates. Particle motion is handled through an ALE formulation. To optimize thecomputational effort and to reduce the remeshing and projection steps required when the meshbecomes too distorted, a rigid motion of the grid in the flow direction is performed, so that, in fact, theparticle moves along the cross-streamline direction only.Confinement and viscoelasticity are found to induce particle migration, i.e., transverse motion acrossthe main flow direction, towards the closest wall. Under continuous shearing, three different dynamicalregimes are recognized, related to the particle-wall distance. A simple heuristic argument is given tolink the crossflow migration to normal stresses in the suspending liquid.The analysis is then extended to a time-dependent shear flow imposed by periodically inverting thedirection of wall motion. A slower migration is found for higher forcing frequency. A peculiar effectarises if the inversion period is chosen close to the fluid relaxation time: the migration velocityoscillates around zero, and the overall migration is suppressed. Such novel prediction of a dynamicinstability scenario, with the particle escaping the center plane of the channel, and many features of thecomputed results, are in nice agreement with recent experiments reported in the literature(B.M.~Lormand and R.J.~Phillips, J. Rheol. 48 (2004) 551-570).