A router is a layer 3 device used to route packets from one subnet to the other. It makes a logical decision based on the destination ip address of the host.
A firewall on the otherhand is used to protect a network from unwanted intrusion into a system. they use ids and ips for the protection of the network. it is usually placed before the private network to protect the internsl equipments.