Relay back emf cauisng my micro controller reset
This EMI problem is either conducted or radiated.

Conducted

Shared supply lines with cascaded voltage drop rather than radial or star connected to a low impedance source .  Add low ESR caps near CPU or uC.

It may be caused by either DC voltage sag on Vcc or Vdd or + ground shift on 0V or Vss. 

Radiated


This is more common and is a result of stray coupling from the antenna effects of a loop current rise time which is inverse to frequency


ΔV=L ΔI/Δt ( or V=LdI/dt)  and the mutual coupling of this current rise time in air at RF speeds. 

It may come from the coil current being switched from the transistor to the diode but is more likely the relay load being switched off with the inductive arc generated by the sudden break in current  
there are many standard solutions to this problem.
first measure it, define the source of interference and offended input


distance ; keep the load wires far away if possible
orientation; do not put near in // near sensitive inputs, instead go at 90 deg. "right" angles
unshielded twisted pair cable (UTP) for both switch load and sensor cables
shielded twisted pair (STP) for both.
add an RC snubber across relay contacts (by design certain criteria)
add a ground plane to electronics or grounded enclosure , aka Faraday cage.
use a line filter between AC loads and protective earth ground (PE)
connect an RF Cap. between isolated supplies to shunt to common mode (CM) noise to protective earth (PE) ground,
add a Balun or CM choke  to  noisy motor line pairs (e.g large Ferrite torroid)
add Ferrite beads and RF caps to uC input signals on cables and switched power
use RF Cap feedthru connectors that shunt signal inputs with pF to case gnd or 0Vdc.
use Opto isolators between driver and switched load to reduce crosstalk { Opto-SCR, Opto-Relay, ZCS-opto-Triac driver} if truly isolated and not shared supplies
use Zero Crossing Sequence (ZCS) Triacs that drive capacitive or inductive loads

ETC.