On the whole, static friction is higher than dynamic friction. This means that if you can brake without your wheels skidding, you will come to a halt more quickly. So let's assume that the truck brakes without skidding, and see where that gets us.
Let's assume that your truck has weight $W = Mg$ with a haystack with additional weight $w = mg$ on top. Coefficient of (static) friction between wheels and road is $\mu_1$, and friction between haystack and truck bed is $\mu_2$.
The normal force on the tires is $W+w$ and the maximum static friction is $\mu_1(W+w)$.
If the wheels stop in a distance $D$ and the hay stack can slide an additional distance $d$ on the truck bed, then the work done to bring the entire assembly to a halt (which must be equal to the kinetic energy we started with) is
$$\mu_1 (W+w) D + \mu_2 w d$$
If there was no movement of the haystack, $d=0$ and the second term would disappear.
So if we have to do the same amount of work to bring the truck to a halt in both cases, we can set the distance of the no-slide truck to $D'$ and we get the expression:
$$\mu_1 (W+w) D + \mu_2 w d = \mu_1(W+w) D'\\ D' = D + \frac{\mu_2 w }{\mu_1(W+w)}d$$
Since the second term is always greater than zero, the stopping distance will be longer for the truck that has the hay stack tied down (or otherwise not sliding).