A bridge connects two similar network segments in computing. A bridge is a device that operates at the data link layer (layer 2) of the OSI model and can connect two LANs (Local Area Networks) or segments of a LAN. It reads the MAC addresses of incoming data packets and decides whether to forward them to the other side of the network or not based on the MAC address table it has learned. Bridges help to reduce network congestion and improve network performance by separating network traffic into different segments.
A gateway, on the other hand, is a device that connects two different networks, such as a LAN and the Internet. A router is also a device that connects two different networks and operates at the network layer (layer 3) of the OSI model.