In some conditions, bacteria self-organize into biofilms, supracellular structures made of a self-produced embedding matrix, mainly composed of polysaccharides, DNA, proteins, and lipids. It is known that bacteria change their colony/matrix ratio in the presence of external stimuli such as hydrodynamic stress. However, little is still known about the molecular mechanisms driving this self-adaptation. In this work, we monitor structural features of Pseudomonas fluorescens biofilms grown with and without hydrodynamic stress. Our measurements show that the hydrodynamic stress concomitantly increases the cell density population and the matrix production. At short growth timescales, the matrix mediates a weak cell-cell attractive interaction due to the depletion forces originated by the polymer constituents. Using a population dynamics model, we conclude that hydrodynamic stress causes a faster diffusion of nutrients and a higher incorporation of planktonic bacteria to the already formed microcolonies. This results in the formation of more mechanically stable biofilms due to an increase of the number of crosslinks, as shown by computer simulations. The mechanical stability also relies on a change in the chemical compositions of the matrix, which becomes enriched in carbohydrates, known to display adhering properties. Overall, we demonstrate that bacteria are capable of self-adapting to hostile hydrodynamic stress by tailoring the biofilm chemical composition, thus affecting both the mesoscale structure of the matrix and its viscoelastic properties that ultimately regulate the bacteria-polymer interactions.