Background: The optimal duration of infusion set use to prevent life-threatening catheter-related bloodstream infection (CRBSI) is unclear. We aimed to compare the effectiveness and costs of 7-day (intervention) versus 4-day (control) infusion set replacement to prevent CRBSI in patients with central venous access devices (tunnelled cuffed, non-tunnelled, peripherally inserted, and totally implanted) and peripheral arterial catheters. Methods: We did a randomised, controlled, assessor-masked trial at ten Australian hospitals. Our hypothesis was CRBSI equivalence for central venous access devices and non-inferiority for peripheral arterial catheters (both 2% margin). Adults and children with expected greater than 24 h central venous access device–peripheral arterial catheter use were randomly assigned (1:1; stratified by hospital, catheter type, and intensive care unit or ward) by a centralised, web-based service (concealed before allocation) to infusion set replacement every 7 days, or 4 days. This included crystalloids, non-lipid parenteral nutrition, and medication infusions. Patients and clinicians were not masked, but the primary outcome (CRBSI) was adjudicated by masked infectious diseases physicians. The analysis was modified intention to treat (mITT). This study is registered with the Australian New Zealand Clinical Trials Registry ACTRN12610000505000 and is complete. Findings: Between May 30, 2011, and Dec, 9, 2016, from 6007 patients assessed, we assigned 2944 patients to 7-day (n=1463) or 4-day (n=1481) infusion set replacement, with 2941 in the mITT analysis. For central venous access devices, 20 (1·78%) of 1124 patients (7-day group) and 16 (1·46%) of 1097 patients (4-day group) had CRBSI (absolute risk difference [ARD] 0·32%, 95% CI −0·73 to 1·37). For peripheral arterial catheters, one (0·28%) of 357 patients in the 7-day group and none of 363 patients in the 4-day group had CRBSI (ARD 0·28%, −0·27% to 0·83%). There were no treatment-related adverse events. Interpretation: Infusion set use can be safely extended to 7 days with resultant cost and workload reductions. Funding: Australian National Health and Medical Research Council.