Remove the shelf from its place on the wall, using a screwdriver if it's screwed to its brackets. Turn it upside down so the sagging portion is facing upward. Place weights along the length of the shelf to help restore it to its original shape.
Allow the shelf to sit under the weights for at least 24 hours to begin restoring its shape. Do not put too much weight on the shelf, as this can cause it to crack or split.
Add at least one more bracket to the existing brackets where the floating shelf sits. This reinforcement will create more support for the shelf and keep it from sagging in the future.
Place the bracket in the center of the existing two brackets to create an even and flat line of support for the shelf. Attach the bracket with screws.
Check the brackets with a level to ensure that the shelf will sit evenly on top once it's replaced.
Put the shelf back on top of the brackets and attach it with screws if necessary. Ensure that the screws are flush with the wood, and that the shelf sits evenly on the brackets.