A liquid ejection head comprising: a substrate including a pressure generating element configured to apply pressure to a first liquid; a member provided with an ejection port configured to eject a second liquid; a pressure chamber including the ejection port and the pressure generating element; and a liquid flow passage formed by using the substrate and the member stacked on the substrate, the liquid flow passage including the pressure chamber and extending in a direction of flow (y) of at least the first liquid and the second liquid, wherein the substrate includes a first common supply flow passage, a first common collection flow passage, a second common supply flow passage, and a second common collection flow passage, a first inflow port located on an upstream side of the pressure chamber in the direction of flow of the liquids in the liquid flow passage, connected to the first common supply flow passage and configured to allow the first liquid to flow into the liquid flow passage, a second inflow port located on the upstream side of the first inflow port, connected to the second common supply flow passage and configured to allow the second liquid to flow into the liquid flow passage, a first outflow port located on a downstream side of the pressure generating element, connected to the first common collection flow passage and configured to allow the first liquid to flow out of the liquid flow passage, a second outflow port located on the downstream side of the first outflow port, connected to the second common collection flow passage and configured to allow the second liquid to flow out of the liquid flow passage, and a lateral wall extending in a direction of extension of the liquid flow passage, at least part of the lateral wall being located above the first inflow port, such that in the pressure chamber, the first liquid flows in contact with the pressure generating element and the second liquid flows closer to the ejection port than the first liquid does. a substrate including a pressure generating element configured to apply pressure to a first liquid; a member provided with an ejection port configured to eject a second liquid; a pressure chamber including the ejection port and the pressure generating element; and a liquid flow passage formed by using the substrate and the member stacked on the substrate, the liquid flow passage including the pressure chamber and extending in a direction of flow (y) of at least the first liquid and the second liquid, wherein the substrate includes a first common supply flow passage, a first common collection flow passage, a second common supply flow passage, and a second common collection flow passage, a first inflow port located on an upstream side of the pressure chamber in the direction of flow of the liquids in the liquid flow passage, connected to the first common supply flow passage and configured to allow the first liquid to flow into the liquid flow passage, a second inflow port located on the upstream side of the first inflow port, connected to the second common supply flow passage and configured to allow the second liquid to flow into the liquid flow passage, a first outflow port located on a downstream side of the pressure generating element, connected to the first common collection flow passage and configured to allow the first liquid to flow out of the liquid flow passage, a second outflow port located on the downstream side of the first outflow port, connected to the second common collection flow passage and configured to allow the second liquid to flow out of the liquid flow passage, and a lateral wall extending in a direction of extension of the liquid flow passage, at least part of the lateral wall being located above the first inflow port, such that a first common supply flow passage, a first common collection flow passage, a second common supply flow passage, and a second common collection flow passage, a first inflow port located on an upstream side of the pressure chamber in the direction of flow of the liquids in the liquid flow passage, connected to the first common supply flow passage and configured to allow the first liquid to flow into the liquid flow passage, a second inflow port located on the upstream side of the first inflow port, connected to the second common supply flow passage and configured to allow the second liquid to flow into the liquid flow passage, a first outflow port located on a downstream side of the pressure generating element, connected to the first common collection flow passage and configured to allow the first liquid to flow out of the liquid flow passage, a second outflow port located on the downstream side of the first outflow port, connected to the second common collection flow passage and configured to allow the second liquid to flow out of the liquid flow passage, and a lateral wall extending in a direction of extension of the liquid flow passage, at least part of the lateral wall being located above the first inflow port, such that in the pressure chamber, the first liquid flows in contact with the pressure generating element and the second liquid flows closer to the ejection port than the first liquid does.