This question has at least 3 answers: 1) Given a von Neumann algebra M, take its canonical L^2-space L^2(M), which is a Hilbert space, take the corresponding canonical representation of M on L^2(M) via left multiplication and take the set of all closed densely-defined unbounded operators affiliated with this representation. This set is not a ring except when M is finite (see below). 2) Given a semifinite (i.e., only type I and type II components are allowed) von Neumann algebra with a faithful semifinite normal trace τ, we can construct a unital *-algebra of τ-measurable operators, which is the completion of M in the τ-measurable topology. There is a canonical injective map from the set of all τ-measurable operators to the set of all affiliated operators in 1), which is not surjective unless M is finite (only type I_n and II_1 components are allowed). Thus in the finite case every affiliated operator is τ-measurable. Note that in the commutative case the unital *-algebra of τ-measurable operators is a proper subalgebra of the algebra of all unbounded functions, in particular the identity function on R is not τ-measurable if τ is the Lebesgue measure on R. 3) We If M is finite, we can also take the maximal noncommutative localization of M with respect to all elements whose left and right support equals 1. The resulting object is a unital *-algebra, which coincides with the usual algebra of unbounded functions in the commutative (type I_1) case and with the algebra of affiliated (or τ-measurable) operators in the finite (type I_n and II_1) case. See my question on this topic for more information: Basically, I want to know what is the relation between 1) and 3) in the type III case. 4) If you are only interested in L^p-spaces, then there is an extremely nice theory due to Haagerup et al. I can comment further on this if you are interested.
To sum up, the best choice seems to be 3)2), however, if you don't need any algebraic operations then 1) also works. For L^p-spaces take 4).
With respect to one of your comments I also want to point out that M does act canonically on a Hilbert space, namely L^2(M). This construction is also functorial in the right category.