The effect of lattice defects at the unit cell level created by the stress field when two rare earths with different ionic radii are mixed at the rare earth site, on the flux pinning and critical current density in Y1-xDyxBa2Cu3O7-δ thin films prepared by the pulsed laser deposition technique, was investigated using SQUID magnetometry at different temperatures for x = 0 to 1 in steps of 0.2. From the isothermal magnetic hysteresis recorded up to 5.5 T at 5,35 and 77 K, the critical current density, pinning force density and irreversibility fields are estimated and their variation as a function of x analysed. An inverse relation between current density and irreversibility field is observed at all the temperatures except for the film having a 20% concentration of Dy in Y which also exhibits the highest critical current density among the films investigated, suggesting this to be the optimum composition for effective flux pinning from stress field induced lattice defects.