In the present study, the heat transfer of unsteady fluid flow between two oscillation plates under the influence of a magnetic field was investigated. The bottom plate was considered fixed and the upper plate could move closer or farther down to the bottom plate. The fluid flow was considered Newtonian, incompressible, two-dimensional, laminar, and unsteady. The governing equations including continuity, momentum and energy were in the form of partial differential equations (PDE); hence, they were transformed into ordinary differential equations (ODE) using similarity transformation. As an innovative method, the ODE governing equations were solved using a semi-analytical method named the Collocation Method (CM). For validity, a numerical 4th order Runge-Kutta method was used. The results revealed that by increasing the magnetic parameter, the horizontal velocity component decreased while the dimensionless temperature and heat transfer rate increased. An increase in the compression parameter led to a reduction of horizontal velocity component, dimensionless temperature, and heat transfer rate. Moreover, when Prandtl and Ecker numbers increased, the dimensionless temperature and heat transfer rate on the walls also increased.