Why does density decrease across the period 4 and 5 transition metals?
Density is generally proportional to how far from a full octet (or in your case, an 18 electron set of outer-most orbitals) a material is, hence this effect, and its inverse - that earlier elements in a period are less dense. This does not apply only to transition metals, but all elements, as illustrated here. (Note: I am not sure what pressure is in that chart, so I suggest ignoring gas-phase elements, including O, F, and Cl.)

The reason for this is fairly simple. The further from a complete octet an element is, the more energetically favorable orbital overlap becomes. The more favorable orbital overlap becomes, the closer elements will pack at a given temperature. There is no energetic benefit to an element with a full octet (ideal gases) overlapping, so they typically do not, and thus form a gas. There is an intense energy benefit in elements with both half-full octets overlapping.