There's no single answer to how many quarts a 5.4-liter engine holds. The oil capacity depends on the *specific* make, model, and year of the vehicle. A 5.4L engine in a Ford truck might hold a different amount than a 5.4L engine in a different manufacturer's vehicle.
You must consult your owner's manual to find the correct oil capacity for your particular engine. This is crucial to avoid overfilling or underfilling, both of which can damage your engine.