One method would be to extract the value using a regular expression. The following works in your test case and populates the milliseconds variable with the value:
$ex = new-object System.Text.RegularExpressions.Regex('(\d+)(.milliseconds)', [System.Text.RegularExpressions.RegexOptions]::Singleline)
$a="Group policy waited for 904 milliseconds for the network subsystem at computer boot."
foreach($match in $ex.Matches($a)){
$milliseconds = $match.Groups[1]
Write-Host $milliseconds
}
Further reading here and a good place to play is here.