Step 1: Picture the friction force graph.
As the chain slides off, the length remaining on the table drops steadily from $\frac{2}{3}L$ to zero, and the friction force is proportional to that length, so a plot of friction force against the slipped distance $y$ is just a straight line from $f_0 = \mu\frac{2}{3}Mg$ down to zero.
Step 2: Use the area under that graph.
The work done against friction is $-1$ times the area under this force versus distance line, and since the line is straight, that area is a triangle.
Step 3: Calculate the triangle's area. \[ \text{Area} = \frac{1}{2}\times f_0\times\frac{2}{3}L = \frac{1}{2}\times\mu\frac{2}{3}Mg\times\frac{2}{3}L = \frac{2}{9}\mu MgL \]
Step 4: Attach the sign.
Friction opposes the sliding, so the work it does is negative.
\[ \boxed{W_f = -\frac{2}{9}\mu MgL} \]