First off, this is QM so let's specialize to hermitian matrices and recall that those always have a complete set of eigenvectors. Suppose A and B are two nxn commuting hermitian matrices over C. And suppose v is an eigenvector of A with eigenvalue a: Av=av. Then, A(Bv)=(AB)v=(BA)v=B(Av)=B(av)=a(Bv). That is to say, if v is an eigenvector of A with eigenvalue, then Bv is also an eigenvector of A with eigenvalue a. Another way to say this is that the eigenspace V_a of A corresponding to the eigenvalue a is stable under B, meaning B(V_a)\subset V_a.
What this means is that if you write the matrix B with respect to a basis of C^n of the form (b_1,...,b_n) where each b_i is an eigenvector of A and where adjacent vectors correspond to the same eigenvalue, then B will be block diagonal. And each block is itself a hermitian matrix, so for instance if the first block is kxk, then it has k linearly independant eigenvectors. And if (w1,...,wk) is any such eigenvector, then (w1,...,wk,0,...0) is an eigenvector of B. And since it lives in the eigenspace of the first eigenvalue of A, then it is also an eigenvector of A. And so like that, for each mxm block of B we find m linearly independant eigenvectors of B which are also eigenvectors of A.