Considering the influence of the viscous dissipation in the energy equation, we investigate the flow and heat transfer of an incompressible micropolar fluid in a channel with expanding or contracting walls. By introducing suitable similarity transformations, the nonlinear partial differential equations are reduced to a system of ordinary differential equations. Homotopy analysis method (HAM) is employed to obtain the series solutions for the velocity, microrotation and temperature distribution. In order to analyze the influence of the micropolar parameter, the Reynolds number and the deformation of the wall, the graphs for velocity components, microrotation, temperature, couple stress and shear stress in the channel are presented and discussed in detail.