In order to get a single gradient to cover multiple objects, you need to use the Gradient Tool.
Select your objects, then with the Gradient Tool, click and drag from where you want the gradient to start, and let go where you want the gradient to end.
This will cause the gradient to cover all selected objects. You can then modify gradient settings using the Gradient Panel
Alternatively you can create a Compound Shape of the multiple objects, if feasible, and that will allow a gradient to see the compound shape as one object. However, Compound Shapes are not always a good solution for overall construction. It depends upon the artwork.