For simplicity (because it was not mentioned in question) I am assuming the XYZ files are ready to be processed (i.e., no classification or filtering is needed) and that the content is suitable for whatever type of raster OP wants (DEM, DSM, etc.).
If one really wants/needs to work with ASCII files, one option to grid them is GDALGDAL gdal_grid:
Creates regular grid from the scattered data.
GRASSGRASS also has the r.in.xyz tool for rasterizing ungridded point cloud data in ASCII format:
The r.in.xyz module will load and bin ungridded x,y,z ASCII data into a new raster map. ...
r.in.xyz is designed for processing massive point cloud datasets, for example raw LIDAR
A third option is PDAL points2grid:
Generates Digital Elevation Models (DEM) using a local gridding method.
On the other hand, I'd convert the ASCII files to binary .las (or .laz) which is the standard LiDAR point cloud format, then would proceed processing from there (especially if this is not a one-time only processing and/or other types of processing are due as well).
Because working with .las is faster; better for storage (more compact); and can take more information (see for example, Benefits of *.las vs *.xyz or *.ascii when working with LiDAR in ArcGIS for Desktop?). Besides, it has more and better software options for processing and visualization.
LAStools txt2las converts ASCII files to .las is free and open source:
Converts LIDAR data from a standard ASCII format into the more efficient binary LAS/LAZ/BIN representations.
Another option is PDAL translate (see example 3):
The translate command can be used for simple conversion of files based on their file extensions.
More useful info in PDAL readers.text and reading with PDAL.
Once having point files in LAS format, gridding them (to a DEM or DSM for example) would be straightforward. Some free/open-source options:
My favourites are the top 3..
- MCC-LIDAR (e.g. Determining bare earth DEM from unclassified LAS file?).
- R through the lidR package. See functions
grid_canopy
andgrid_terrain
. - FUSION (e.g. Creating DEM from LAS file without using LAStools? Getting statistics in cross sections at varying heights in LAS files?). Preferably use it as a standalone software (i.e. through command line mode).
- GRASS r.in.lidar.
- PDAL through GDAL writer drivers.