Although both gateways and routers are a part of the process of regulating traffic between two networks, they are different from one another: gateways regulate traffic between two different types of networks, while routers regulate traffic between two similar networks. Even though gateways and routers perform similar functions, this difference means that they are used in different settings and for different reasons.
When a corporation or another group has two different networks that it would like to have interact with one another, it's necessary to regulate and facilitate the traffic between the two. This can be done by taking either a router or a gateway and outfitting it with several network cards. The router or gateway is then placed in between the two networks so that the process of regulation can begin.
However, before determining whether a router or gateway is needed, these groups need to evaluate the networks they are regulating. For example, a computer that is accessing the Internet through the standard Internet Protocol can be used with a router because it uses the same type of networking protocols as the Internet does. But for other combinations of networks, such as a computer with an unusual mainframe environment attempting to join a network of other computers, a gateway is needed.